From 36b3dc74cac8c37356b25d8b95fe633cd3d67134 Mon Sep 17 00:00:00 2001 From: Massimiliano Date: Mon, 24 Oct 2022 19:55:46 -0400 Subject: [PATCH] Cleaning up --- .../include/Neon/core/tools/io/IODense_imp.h | 6 +++--- .../include/Neon/core/tools/io/exportVTI.h | 2 +- .../include/Neon/core/tools/io/ioToVti.h | 4 ++-- .../unit/coreUt_io/src/coreUt_io.dense.cpp | 3 +-- .../domain-unit-test-map/src/TestInformation.h | 4 +++- .../src/RunHelper.h | 15 ++++++++------- .../src/TestInformation.h | 18 ++++++++++++++++++ .../src/staggeredGrid.cpp | 14 +++++++++----- libNeonSet/include/Neon/set/Backend.h | 2 +- libNeonSet/include/Neon/set/Capture.h | 2 +- libNeonSet/include/Neon/set/container/Loader.h | 4 ++-- libNeonSet/src/set/Backend.cpp | 10 +++++----- libNeonSys/include/Neon/sys/memory/memConf.h | 2 +- .../src/sys/devices/gpu/gpuDeviceMemory.cpp | 4 ++-- 14 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h diff --git a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h index f8c2a355..8b5da32e 100644 --- a/libNeonCore/include/Neon/core/tools/io/IODense_imp.h +++ b/libNeonCore/include/Neon/core/tools/io/IODense_imp.h @@ -56,10 +56,10 @@ IODense::IODense(const Integer_3d& d, template -IODense::IODense(const Integer_3d& d, - int c, +IODense::IODense(const Integer_3d& d, + int c, const std::function&, int cardinality)>& fun) - : mSpace(d), mCardinality(c), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun) + : mSpace(d), mCardinality(c), mOrder(), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun) { initPitch(); diff --git a/libNeonCore/include/Neon/core/tools/io/exportVTI.h b/libNeonCore/include/Neon/core/tools/io/exportVTI.h index 246c1e5a..4509de82 100644 --- a/libNeonCore/include/Neon/core/tools/io/exportVTI.h +++ b/libNeonCore/include/Neon/core/tools/io/exportVTI.h @@ -1104,7 +1104,7 @@ class vtiOutput_t interlivingError = interlivingError || ((!isNode) && m_voxelSectionDone); if (interlivingError) { std::string msg = std::string( - "VoxelGeneric and NodeGeneric data can not be interleaved in the same VTI file. Pleas add " + "Voxel and Node data can not be interleaved in the same VTI file. Pleas add " "first all the data for one of the two, then add the remaining one."); throw std::runtime_error(msg); } diff --git a/libNeonCore/include/Neon/core/tools/io/ioToVti.h b/libNeonCore/include/Neon/core/tools/io/ioToVti.h index d71b2e5d..1152dcd5 100644 --- a/libNeonCore/include/Neon/core/tools/io/ioToVti.h +++ b/libNeonCore/include/Neon/core/tools/io/ioToVti.h @@ -628,7 +628,7 @@ template if (!(voxSpace == (nodeSpace - 1))) { NeonException exception("ioToVTI"); - exception << "Inconsistent data. NodeGeneric space dimension should be bigger than voxel of one unit."; + exception << "Inconsistent data. Node space dimension should be bigger than voxel of one unit."; NEON_THROW(exception); } @@ -679,7 +679,7 @@ void ioToVTI(const std::vector>& gridsInfo, using namespace internal_implicit::ns_help_write_vti; if (!(voxSpace == (nodeSpace - 1))) { NeonException exception("ioToVTI"); - exception << "Inconsistent data. NodeGeneric space dimension should be bigger than voxel of one unit."; + exception << "Inconsistent data. Node space dimension should be bigger than voxel of one unit."; NEON_THROW(exception); } diff --git a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp index 261f8bc4..346ee231 100644 --- a/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp +++ b/libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp @@ -73,5 +73,4 @@ TEST(coreUt_io, denseDiffRandom) ASSERT_EQ(maxDiff.z, id.z); ASSERT_EQ(maxCard, card); } - A.ioVtk("A", "A"); -} \ No newline at end of file +} diff --git a/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h b/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h index cb96dc7d..3ac50ecd 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h +++ b/libNeonDomain/tests/unit/domain-unit-test-map/src/TestInformation.h @@ -2,12 +2,14 @@ namespace { struct TestInformation { - static auto prefix() -> std::string + static auto prefix() + -> std::string { return "domain-unit-test-map"; } static auto fullName(const std::string& gridName) + -> std::string { return prefix() + "-" + gridName; } diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h index e354a164..bcb34847 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/RunHelper.h @@ -21,7 +21,7 @@ using namespace Neon::domain::tool::testing; using namespace Neon::domain::tool; template -void runAllTestConfiguration(const std::string& , +void runAllTestConfiguration(const std::string&, std::function&)> f, int nGpus, int minNumGpus) @@ -33,12 +33,12 @@ void runAllTestConfiguration(const std::string& , } // std::vector nGpuTest{2,4,6,8}; std::vector cardinalityTest{1}; - //nGpuTest = std::vector(1,1); + // nGpuTest = std::vector(1,1); - std::vector dimTest{{60, 10, 250}, {10, 50, 40}}; + std::vector dimTest{{60, 10, 250}, {10, 50, 80}}; std::vector runtimeE{Neon::Runtime::openmp, Neon::Runtime::stream}; - //std::vector dimTest{{3}}; - //std::vector runtimeE{Neon::Runtime::stream}; + // std::vector dimTest{{3}}; + // std::vector runtimeE{Neon::Runtime::stream}; std::vector geos; @@ -66,7 +66,8 @@ void runAllTestConfiguration(const std::string& , ids.push_back(i % maxnGPUs); } - Neon::Backend backend(ids, runtime); + Neon::Backend backend(ids, runtime); + NEON_INFO("{}",backend.toString()); Neon::MemoryOptions memoryOptions = backend.getMemoryOptions(); TestData testData(backend, @@ -75,7 +76,7 @@ void runAllTestConfiguration(const std::string& , memoryOptions, geo); - std::cout << testData.toString() << std::endl; + NEON_INFO("{}", testData.toString() ); f(testData); } diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h new file mode 100644 index 00000000..46051bc4 --- /dev/null +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/TestInformation.h @@ -0,0 +1,18 @@ +#pragma once +namespace { +struct TestInformation +{ + static auto prefix() + -> std::string + { + return "domain-unit-test-staggered-grid"; + } + + static auto fullName(const std::string& gridName, + const std::string& subTestName) + -> std::string + { + return prefix() + "-" +subTestName+"-"+ gridName; + } +}; +} // namespace \ No newline at end of file diff --git a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp index bb7071d0..3f28187c 100644 --- a/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp +++ b/libNeonDomain/tests/unit/domain-unit-test-staggered-grid/src/staggeredGrid.cpp @@ -7,12 +7,11 @@ #include "containers.h" #include "Neon/domain/StaggeredGrid.h" +#include "TestInformation.h" #define EXECUTE_IO_TO_VTK 0 using namespace Neon::domain::tool::testing; -static const std::string testFilePrefix("domain-unit-test-staggered-grid"); - template void StaggeredGrid_Map(TestData& data) @@ -51,7 +50,8 @@ void StaggeredGrid_Map(TestData& data) temperature.updateCompute(Neon::Backend::mainStreamIdx); density.updateCompute(Neon::Backend::mainStreamIdx); - const std::string appName(testFilePrefix + "_Map_" + data.getGrid().getImplementationName()); + const std::string appName = TestInformation::fullName("_map_", data.getGrid().getImplementationName()); + if constexpr (EXECUTE_IO_TO_VTK == 1) { temperature.ioToVtk(appName + "-temperature_asVoxels", "temperature", false, Neon::IoFileType::ASCII, false); density.ioToVtk(appName + "-density_0000", "density"); @@ -98,12 +98,16 @@ template void StaggeredGrid_VoxToNodes(TestData& data) { // - Neon::int32_3d dims{3, 2, 4}; + Neon::int32_3d voxDim = [&] { + auto dim = data.getGrid().getDimension(); + return dim; + }(); + std::vector empty; using FeaGrid = Neon::domain::internal::experimental::staggeredGrid::StaggeredGrid; FeaGrid FEA( data.getBackend(), - dims, + voxDim, [](const Neon::index_3d&) -> bool { return true; }); diff --git a/libNeonSet/include/Neon/set/Backend.h b/libNeonSet/include/Neon/set/Backend.h index 1be7933f..22f40fcc 100644 --- a/libNeonSet/include/Neon/set/Backend.h +++ b/libNeonSet/include/Neon/set/Backend.h @@ -55,7 +55,7 @@ class Backend Backend(); /** - * Creating a Backend_t object with the first nGpus devices. + * Creating a Backend object with the first nGpus devices. */ Backend(int nGpus /*! Number of devices. The devices are selected in the order specifies by CUDA */, Neon::Runtime runtime /*! Type of runtime to use */); diff --git a/libNeonSet/include/Neon/set/Capture.h b/libNeonSet/include/Neon/set/Capture.h index 87d13f04..eea1ae18 100644 --- a/libNeonSet/include/Neon/set/Capture.h +++ b/libNeonSet/include/Neon/set/Capture.h @@ -13,7 +13,7 @@ namespace set { */ struct Capture_t { - friend Backend_t; + friend Backend; private: Neon::dev_et::enum_e m_devType; /** type of device */ diff --git a/libNeonSet/include/Neon/set/container/Loader.h b/libNeonSet/include/Neon/set/container/Loader.h index ff18e703..bdbfe74e 100644 --- a/libNeonSet/include/Neon/set/container/Loader.h +++ b/libNeonSet/include/Neon/set/container/Loader.h @@ -64,7 +64,7 @@ template struct HaloUpdateExtractor_t { // field.haloUpdate(bk, opt); - // const Neon::set::Backend_t& /*bk*/, + // const Neon::set::Backend& /*bk*/, // Neon::set::HuOptions_t& /*opt*/ private: template @@ -96,7 +96,7 @@ template struct HaloUpdatePerDeviceExtractor_t { // field.haloUpdate(bk, opt); - // const Neon::set::Backend_t& /*bk*/, + // const Neon::set::Backend& /*bk*/, // Neon::set::HuOptions_t& /*opt*/ private: template diff --git a/libNeonSet/src/set/Backend.cpp b/libNeonSet/src/set/Backend.cpp index ddf46090..24cdd5ed 100644 --- a/libNeonSet/src/set/Backend.cpp +++ b/libNeonSet/src/set/Backend.cpp @@ -396,7 +396,7 @@ auto Backend::sync() const -> void return selfData().streamSetVec[0].sync(); } NeonException exp("BackendConfig_t"); - exp << "Backend_t::sync() not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; + exp << "Backend::sync() not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; NEON_THROW(exp); } @@ -413,7 +413,7 @@ auto Backend::syncAll() const -> void return; } NeonException exp("BackendConfig_t"); - exp << "Backend_t::syncAll() not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; + exp << "Backend::syncAll() not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; NEON_THROW(exp); } @@ -427,7 +427,7 @@ auto Backend::sync(int idx) const -> void return; } NeonException exp("BackendConfig_t"); - exp << "Backend_t::sync with idx not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; + exp << "Backend::sync with idx not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; NEON_THROW(exp); } @@ -441,7 +441,7 @@ auto Backend::sync(Neon::SetIdx setIdx, int idx) const -> void return; } NeonException exp("BackendConfig_t"); - exp << "Backend_t::sync with idx not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; + exp << "Backend::sync with idx not permitted for a " << Neon::RuntimeUtils::toString(runtime()) << "backend"; NEON_THROW(exp); } @@ -477,7 +477,7 @@ std::string Backend::toString(Neon::Runtime e) std::string Backend::toString() const { std::ostringstream msg; - msg << "Backend_t (" << this << ") - [runtime:" << toString(selfData().runtime) << "] [nDev:" << selfData().devSet->setCardinality() << "] "; + msg << "Backend (" << this << ") - [runtime:" << toString(selfData().runtime) << "] [nDev:" << selfData().devSet->setCardinality() << "] "; switch (selfData().devSet->type()) { case Neon::DeviceType::OMP: case Neon::DeviceType::CPU: { diff --git a/libNeonSys/include/Neon/sys/memory/memConf.h b/libNeonSys/include/Neon/sys/memory/memConf.h index 0030323c..f07667e3 100644 --- a/libNeonSys/include/Neon/sys/memory/memConf.h +++ b/libNeonSys/include/Neon/sys/memory/memConf.h @@ -179,7 +179,7 @@ struct [[deprecated("This feature is going to be replaced by a new API for Neon * * @return */ - auto padding() const->const Neon::memLayout_et:: padding_e& + auto padding() const->const Neon::memLayout_et::padding_e& { return m_paddingEt; } diff --git a/libNeonSys/src/sys/devices/gpu/gpuDeviceMemory.cpp b/libNeonSys/src/sys/devices/gpu/gpuDeviceMemory.cpp index 16deaa85..ff7f0dc1 100644 --- a/libNeonSys/src/sys/devices/gpu/gpuDeviceMemory.cpp +++ b/libNeonSys/src/sys/devices/gpu/gpuDeviceMemory.cpp @@ -39,13 +39,13 @@ void GpuDevice::memory_t::enablePeerAccsessWith(ComputeID gpuId) const if (cudaErrorPeerAccessAlreadyEnabled == res) { cudaGetLastError(); //so that we don't see this error when we do cuda error checking - NEON_WARNING("GpuDev_t: CUDA device {} is already enabled for peer access w.r.t. CUDA device, {}", gpuDev.getIdx().idx(), gpuId.idx()); + NEON_WARNING("GpuDev: CUDA device {} is already enabled for peer access w.r.t. CUDA device, {}", gpuDev.getIdx().idx(), gpuId.idx()); return; } if (cudaErrorPeerAccessUnsupported == res) { cudaGetLastError(); //so that we don't see this error when we do cuda error checking - NEON_WARNING("GpuDev_t: CUDA error completing cudaDeviceEnablePeerAccess operation. CUDA device {} does not support peer access {}", gpuDev.getIdx().idx(), gpuId.idx()); + NEON_WARNING("GpuDev: CUDA error completing cudaDeviceEnablePeerAccess operation. CUDA device {} does not support peer access {}", gpuDev.getIdx().idx(), gpuId.idx()); return; }