diff --git a/include/astaroth.h b/include/astaroth.h index d32b367..039ab82 100644 --- a/include/astaroth.h +++ b/include/astaroth.h @@ -284,6 +284,9 @@ Resets all devices on the current grid. */ AcResult acGridQuit(void); +/** Randomizes the local mesh */ +AcResult acGridRandomize(void); + /** */ AcResult acGridSynchronizeStream(const Stream stream); diff --git a/samples/benchmark/main.cc b/samples/benchmark/main.cc index 3c5e504..76223bb 100644 --- a/samples/benchmark/main.cc +++ b/samples/benchmark/main.cc @@ -107,7 +107,7 @@ main(int argc, char** argv) } } - const TestType test = TEST_STRONG_SCALING; + const TestType test = TEST_WEAK_SCALING; if (test == TEST_WEAK_SCALING) { uint3_64 decomp = decompose(nprocs); info.int_params[AC_nx] *= decomp.x; @@ -126,10 +126,15 @@ main(int argc, char** argv) // GPU alloc & compute acGridInit(info); + acGridRandomize(); + + /* AcMesh model; acMeshCreate(info, &model); acMeshRandomize(&model); acGridLoadMesh(STREAM_DEFAULT, model); + */ + /* acGridLoadMesh(STREAM_DEFAULT, model); diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ca96366..15cd4fa 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -2,7 +2,7 @@ find_package(CUDAToolkit) ## Astaroth Core add_library(astaroth_core STATIC device.cc node.cc astaroth.cc astaroth_fortran.cc) -target_link_libraries(astaroth_core astaroth_kernels CUDA::cudart CUDA::cuda_driver) +target_link_libraries(astaroth_core astaroth_utils astaroth_kernels CUDA::cudart CUDA::cuda_driver) ## Options if (MPI_ENABLED) diff --git a/src/core/device.cc b/src/core/device.cc index 0ee987f..4af17fc 100644 --- a/src/core/device.cc +++ b/src/core/device.cc @@ -1242,6 +1242,22 @@ acGridSynchronizeStream(const Stream stream) return AC_SUCCESS; } + +#include "astaroth_utils.h" // HACK TO RANDOMIZE +AcResult +acGridRandomize(void) +{ + ERRCHK(grid.initialized); + + AcMesh host; + acMeshCreate(grid.submesh.info, &host); + acMeshRandomize(&host); + acDeviceLoadMesh(grid.device, STREAM_DEFAULT, host); + acMeshDestroy(&host); + + return AC_SUCCESS; +} + AcResult acGridInit(const AcMeshInfo info) {