Skip to content

Commit

Permalink
Cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
massimim committed Oct 25, 2022
1 parent 2b46d46 commit 36b3dc7
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 33 deletions.
6 changes: 3 additions & 3 deletions libNeonCore/include/Neon/core/tools/io/IODense_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ IODense<ExportType, IntType>::IODense(const Integer_3d<IntType>& d,

template <typename ExportType,
typename IntType>
IODense<ExportType, IntType>::IODense(const Integer_3d<IntType>& d,
int c,
IODense<ExportType, IntType>::IODense(const Integer_3d<IntType>& d,
int c,
const std::function<ExportType(const Integer_3d<IntType>&, int cardinality)>& fun)
: mSpace(d), mCardinality(c), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun)
: mSpace(d), mCardinality(c), mOrder(), mRepresentation(Representation::IMPLICIT), mImplicitFun(fun)

{
initPitch();
Expand Down
2 changes: 1 addition & 1 deletion libNeonCore/include/Neon/core/tools/io/exportVTI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions libNeonCore/include/Neon/core/tools/io/ioToVti.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ template <typename intType_ta, typename real_tt = double>

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);
}

Expand Down Expand Up @@ -679,7 +679,7 @@ void ioToVTI(const std::vector<VtiInputData_t<real_tt, intType_ta>>& 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);
}

Expand Down
3 changes: 1 addition & 2 deletions libNeonCore/tests/unit/coreUt_io/src/coreUt_io.dense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,4 @@ TEST(coreUt_io, denseDiffRandom)
ASSERT_EQ(maxDiff.z, id.z);
ASSERT_EQ(maxCard, card);
}
A.ioVtk("A", "A");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using namespace Neon::domain::tool::testing;
using namespace Neon::domain::tool;

template <typename G, typename T, int C>
void runAllTestConfiguration(const std::string& ,
void runAllTestConfiguration(const std::string&,
std::function<void(TestData<G, T, C>&)> f,
int nGpus,
int minNumGpus)
Expand All @@ -33,12 +33,12 @@ void runAllTestConfiguration(const std::string& ,
}
// std::vector<int> nGpuTest{2,4,6,8};
std::vector<int> cardinalityTest{1};
//nGpuTest = std::vector<int>(1,1);
// nGpuTest = std::vector<int>(1,1);

std::vector<Neon::index_3d> dimTest{{60, 10, 250}, {10, 50, 40}};
std::vector<Neon::index_3d> dimTest{{60, 10, 250}, {10, 50, 80}};
std::vector<Neon::Runtime> runtimeE{Neon::Runtime::openmp, Neon::Runtime::stream};
//std::vector<Neon::index_3d> dimTest{{3}};
//std::vector<Neon::Runtime> runtimeE{Neon::Runtime::stream};
// std::vector<Neon::index_3d> dimTest{{3}};
// std::vector<Neon::Runtime> runtimeE{Neon::Runtime::stream};

std::vector<Geometry> geos;

Expand Down Expand Up @@ -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<G, T, C> testData(backend,
Expand All @@ -75,7 +76,7 @@ void runAllTestConfiguration(const std::string& ,
memoryOptions,
geo);

std::cout << testData.toString() << std::endl;
NEON_INFO("{}", testData.toString() );

f(testData);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename G, typename T, int C>
void StaggeredGrid_Map(TestData<G, T, C>& data)
Expand Down Expand Up @@ -51,7 +50,8 @@ void StaggeredGrid_Map(TestData<G, T, C>& 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");
Expand Down Expand Up @@ -98,12 +98,16 @@ template <typename G, typename T, int C>
void StaggeredGrid_VoxToNodes(TestData<G, T, C>& data)
{
//
Neon::int32_3d dims{3, 2, 4};
Neon::int32_3d voxDim = [&] {
auto dim = data.getGrid().getDimension();
return dim;
}();

std::vector<Neon::domain::Stencil> empty;
using FeaGrid = Neon::domain::internal::experimental::staggeredGrid::StaggeredGrid<G>;
FeaGrid FEA(
data.getBackend(),
dims,
voxDim,
[](const Neon::index_3d&) -> bool {
return true;
});
Expand Down
2 changes: 1 addition & 1 deletion libNeonSet/include/Neon/set/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */);
Expand Down
2 changes: 1 addition & 1 deletion libNeonSet/include/Neon/set/Capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions libNeonSet/include/Neon/set/container/Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ template <typename Field_ta>
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 <typename T>
Expand Down Expand Up @@ -96,7 +96,7 @@ template <typename Field_ta>
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 <typename T>
Expand Down
10 changes: 5 additions & 5 deletions libNeonSet/src/set/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion libNeonSys/include/Neon/sys/memory/memConf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions libNeonSys/src/sys/devices/gpu/gpuDeviceMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 36b3dc7

Please sign in to comment.