schiff

Estimate the radiative properties of soft particless
git clone git://git.meso-star.com/schiff.git
Log | Files | Refs | README | LICENSE

commit ac83a839c46d0b785b35cf0b82a6cfa8e1ea25c2
parent f1639084f209908ba73006071c13548bf83c94bf
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  1 Oct 2021 10:48:52 +0200

Log the elapsed time of some steps

Time the generation of the geometry distribution, the writing of the
geometries and the computation.

Diffstat:
Msrc/schiff.c | 27++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/schiff.c b/src/schiff.c @@ -18,6 +18,7 @@ #include "schiff_geometry.h" #include "schiff_optical_properties.h" +#include <rsys/clock_time.h> #include <rsys/stretchy_array.h> #include <star/s3d.h> @@ -322,6 +323,8 @@ run_integration struct ssp_rng* rng, FILE* stream) { + char dump[128]; + struct time t0, t1; struct sschiff_device* sschiff = NULL; struct sschiff_estimator* estimator = NULL; size_t nwlens; @@ -334,6 +337,8 @@ run_integration goto error; } + time_current(&t0); + /* Invoke the Schiff integration */ nwlens = sa_size(args->wavelengths); res = sschiff_integrate(sschiff, rng, distrib, args->wavelengths, nwlens, @@ -344,6 +349,10 @@ run_integration goto error; } + time_sub(&t0, time_current(&t1), &t0); + time_dump(&t0, TIME_ALL, NULL, dump, sizeof(dump)); + fprintf(stderr, "Computation performed in %s.\n", dump); + /* Write results */ write_cross_sections(stream, estimator, args->wavelengths, nwlens); write_phase_function_descriptors @@ -364,6 +373,8 @@ error: static res_T run(const struct schiff_args* args) { + char dump[128]; + struct time t0, t1; FILE* fp = stdout; struct sschiff_geometry_distribution distrib = SSCHIFF_NULL_GEOMETRY_DISTRIBUTION; struct ssp_rng* rng = NULL; @@ -393,6 +404,8 @@ run(const struct schiff_args* args) goto error; } + time_current(&t0); + res = schiff_geometry_distribution_init(&distrib, s3d, args->geoms, sa_size(args->geoms), args->characteristic_length, args->ran_geoms, args->properties); @@ -402,10 +415,18 @@ run(const struct schiff_args* args) goto error; } - if(args->ngeoms_dump) { - res = dump_geometries(args, s3d, &distrib, rng, fp); - } else { + time_sub(&t0, time_current(&t1), &t0); + time_dump(&t0, TIME_ALL, NULL, dump, sizeof(dump)); + fprintf(stderr, "Initialized the geometry distribution in %s.\n", dump); + + if(!args->ngeoms_dump) { res = run_integration(args, s3d, &distrib, rng, fp); + } else { + time_current(&t0); + res = dump_geometries(args, s3d, &distrib, rng, fp); + time_sub(&t0, time_current(&t1), &t0); + time_dump(&t0, TIME_ALL, NULL, dump, sizeof(dump)); + fprintf(stderr, "Dump geometries in %s.\n", dump); } /* Release before the check of the integration error code since if an error