rnatm

Load and structure data describing an atmosphere
git clone git://git.meso-star.fr/rnatm.git
Log | Files | Refs | README | LICENSE

commit 72a23e38d186959ffc8a12f17d7c33196895d0de
parent e272f9c46e39be32a57cc1c3dd1587f68d766fbd
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 26 Jul 2022 18:31:59 +0200

Small update of the octree building

Adjust the number of preallocated partitions as well as their
definition. Record and print the time spent during octree building as
well as the memory space used by the octree.

Diffstat:
Mcmake/CMakeLists.txt | 2+-
Msrc/rnatm_octree.c | 19++++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -31,7 +31,7 @@ option(NO_TEST "Do not build tests" OFF) find_package(OpenMP 1.2 REQUIRED) find_package(RCMake 0.4 REQUIRED) find_package(RNSF REQUIRED) -find_package(RSys 0.9 REQUIRED) +find_package(RSys 0.12.1 REQUIRED) find_package(StarAerosol REQUIRED) find_package(StarBuffer REQUIRED) find_package(StarCK REQUIRED) diff --git a/src/rnatm_octree.c b/src/rnatm_octree.c @@ -38,14 +38,13 @@ #include <omp.h> struct build_octrees_context { - struct rnatm* atm; struct pool* pool; struct partition* part; /* Current partition */ /* Optical thickness threshold criteria for merging voxels */ double tau_threshold; }; -#define BUILD_OCTREES_CONTEXT_NULL__ { NULL, NULL, NULL, 0 } +#define BUILD_OCTREES_CONTEXT_NULL__ {NULL, NULL, 0} static const struct build_octrees_context BUILD_OCTREES_CONTEXT_NULL = BUILD_OCTREES_CONTEXT_NULL__; @@ -399,6 +398,9 @@ voxelize_atmosphere(struct rnatm* atm, struct pool* pool) nparts_adjusted = round_up_pow2(nparts_adjusted); nparts_adjusted = nparts_adjusted * nparts_adjusted * nparts_adjusted; + /* Print the size of a voxel */ + log_info(atm, "voxel size = {%g, %g, %g}\n", SPLIT3(vxsz)); + /* Print status message */ #define LOG_MSG "voxelize atmosphere: %3d%%\r" log_info(atm, LOG_MSG, 0); @@ -585,7 +587,7 @@ vx_challenge_merge upp[2] = MMAX(vxs[ivx].upper[2], upp[2]); } - /* Compute the size of the largest dimension of the ABB */ + /* Compute the size of the largest dimension of the AABB */ sz_max = upp[0] - low[0]; sz_max = MMAX(upp[1] - low[1], sz_max); sz_max = MMAX(upp[2] - low[2], sz_max); @@ -614,7 +616,6 @@ build_octrees if(res != RES_OK) goto error; /* Setup the build context */ - ctx.atm = atm; ctx.pool = pool; ctx.tau_threshold = args->optical_thickness; ctx.part = NULL; @@ -658,7 +659,7 @@ create_octrees(struct rnatm* atm, const struct rnatm_create_args* args) /* Empirical constant that defines the number of voxel partitions to * pre-allocate per thread to avoid contension between the thread building the * octrees from the partitions and the threads that fill these partitions */ - const size_t NPARTITIONS_PER_THREAD = 16; + const size_t NPARTITIONS_PER_THREAD = 1024; struct pool_create_args pool_args = POOL_CREATE_ARGS_DEFAULT; struct pool* pool = NULL; @@ -671,7 +672,7 @@ create_octrees(struct rnatm* atm, const struct rnatm_create_args* args) pool_args.nbands = sck_get_bands_count(atm->gas.ck); pool_args.nquad_pts = band_get_quad_pt_count; pool_args.context = atm->gas.ck; - pool_args.partition_definition = 4; + pool_args.partition_definition = 8; pool_args.allocator = atm->allocator; res = pool_create(&pool_args, &pool); if(res != RES_OK) { @@ -744,10 +745,10 @@ setup_octrees(struct rnatm* atm, const struct rnatm_create_args* args) time_dump(&t0, TIME_ALL, NULL, buf, sizeof(buf)); log_info(atm, "acceleration structures built in %s\n", buf); - /* Log memory space used by Star-VX - * TODO make human readable the printed size */ + /* Log memory space used by Star-VX */ sz = MEM_ALLOCATED_SIZE(&atm->svx_allocator); - log_info(atm, "Star-VoXel memory space: %lu\n", (unsigned long)sz); + size_to_cstr(sz, SIZE_ALL, NULL, buf, sizeof(buf)); + log_info(atm, "Star-VoXel memory space: %s\n", buf); exit: return res;