Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skeleton refactoring #28

Merged
merged 77 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
7ee19a1
DeviceTypeUtil: fixing name in string.
massimim Jul 14, 2022
1fe86f4
Adding a mutable version of getBackend in GridBase.
massimim Jul 14, 2022
ef1b18a
WIP: New container interface
massimim Jul 14, 2022
a07f632
Adding some extra information to report for a device report.
massimim Jul 14, 2022
cc64f77
WIP: New container interface
massimim Jul 14, 2022
f03bb2e
Documentation
massimim Jul 18, 2022
f4d851d
Merge remote-tracking branch 'origin/develop' into container
massimim Jul 18, 2022
1d06c32
Fixing merging issues.
massimim Jul 18, 2022
090e57f
Documentation
massimim Jul 18, 2022
182155b
Imposing coding standards on the Container class.
massimim Jul 18, 2022
0a944c3
WIP: new container graph mechanism.
massimim Jul 19, 2022
b2cefa1
Merge remote-tracking branch 'origin/develop' into container
massimim Aug 8, 2022
3c7a25b
WIP
massimim Aug 8, 2022
7942c0a
WIP
massimim Aug 9, 2022
23b2d34
WIP
massimim Aug 10, 2022
87ffb4c
WIP
massimim Aug 12, 2022
7d11d4d
WIP
massimim Aug 12, 2022
c05341e
WIP
massimim Aug 12, 2022
78bb946
WIP
massimim Aug 12, 2022
fe27bd2
WIP
massimim Aug 12, 2022
f709e8b
WIP
massimim Aug 12, 2022
cf2dee4
WIP
massimim Aug 12, 2022
0796ddb
WIP
massimim Aug 22, 2022
16f4e5d
WIP
massimim Aug 22, 2022
1583db7
WIP
massimim Aug 23, 2022
bd57943
WIP
massimim Aug 23, 2022
b62fb87
WIP
massimim Aug 24, 2022
150a045
WIP
massimim Aug 29, 2022
601915f
WIP
massimim Aug 30, 2022
1a67851
WIP
massimim Aug 31, 2022
cc478a8
WIP
massimim Sep 2, 2022
3ca3d30
Merge remote-tracking branch 'origin/develop' into container
massimim Sep 2, 2022
08a3a40
New container graph completed, including unit tests.
massimim Sep 12, 2022
04295df
WIP
massimim Sep 17, 2022
8059cf3
WIP
massimim Sep 17, 2022
b9c587b
New container graph completed, including unit tests.
massimim Sep 12, 2022
7d377c3
Merge branch 'container' into skeleton
massimim Sep 17, 2022
c3383ab
New container graph completed, including unit tests.
massimim Sep 12, 2022
61bad15
Merge branch 'container' into skeleton
massimim Sep 18, 2022
0b3aa25
WIP
massimim Sep 18, 2022
c696b27
Fixing compilation issue on windows.
massimim Sep 18, 2022
7401d94
WIP
massimim Sep 18, 2022
eec0094
Merge branch 'container' into skeleton
massimim Sep 18, 2022
0b3b74f
WIP
massimim Sep 24, 2022
df579ac
Merge remote-tracking branch 'origin/develop' into skeleton
massimim Oct 21, 2022
7e08c1c
Fixing merging issues after merging develop.
massimim Oct 21, 2022
2c4b9ca
Some clean up.
massimim Oct 21, 2022
e9f9f84
Merge remote-tracking branch 'origin/develop' into skeleton
massimim Oct 25, 2022
4f00eaa
Merge remote-tracking branch 'origin/develop' into skeleton
massimim Oct 25, 2022
f4072ff
WIP
massimim Oct 25, 2022
fe762b2
New Container for data transfers.
massimim Oct 25, 2022
a8b3a03
Managing communication nodes.
massimim Oct 30, 2022
e8f0218
Working on halo updates.
massimim Oct 31, 2022
30b428a
No OCC graph generator complete.
massimim Nov 3, 2022
d94769b
Fixing ioToDot text.
massimim Nov 3, 2022
c74bb2d
Fix for BFS.
massimim Nov 4, 2022
5696b5b
WIP - fixing execution order.
massimim Nov 4, 2022
aaa0a27
Standard, extended and two way OCC optimisations.
massimim Nov 4, 2022
c15335f
WIP
massimim Nov 8, 2022
7228886
WIP
massimim Nov 8, 2022
b7927d0
Fixing old managed container API.
massimim Nov 8, 2022
2a833b5
Mechanism to support eGrid in the new skeleton.
massimim Nov 8, 2022
db8a4fb
Mechanism to support eGrid in the new skeleton.
massimim Nov 8, 2022
78095e2
Merge remote-tracking branch 'origin/skeleton' into skeleton
massimim Nov 8, 2022
a924689
Cleaning up.
massimim Nov 8, 2022
5e874af
WIP
massimim Nov 9, 2022
ddaf844
Adding support for those cases where a stencil nodes follows the begi…
massimim Nov 10, 2022
58cd81c
Adding support for those cases where a stencil nodes follows the begi…
massimim Nov 10, 2022
4fd3454
Adding support for those cases where a stencil nodes follows the begi…
massimim Nov 10, 2022
347d9a3
Fixing compilation issue on Ubuntu.
massimim Nov 22, 2022
e49b486
Fixing compiler issues on Windows
massimim Nov 23, 2022
447d784
WIP
massimim Nov 25, 2022
c5fcc6a
Increasing domain side for 8-GPU computation.
massimim Nov 25, 2022
c85a387
Disabling domain-unit-test-staggered-grid NodeToVoxels.dGrid test.
massimim Nov 25, 2022
754ced0
Adding Ahmed's fix for the cmake-openmp issue on windows.
massimim Dec 8, 2022
108dd9a
Temporarily disabling staggered grid unit tests.
massimim Dec 8, 2022
4c9fc6b
Fixing compiler issue on Windows.
massimim Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmake/ManageCompilationFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ set(NeonCXXFlags

#Add GCC specific compiler flags here
#-Wno-class-memaccess for "writing to an object of type XXX with no trivial copy-assignment; use copy-assignment or copy-initialization instead"
$<$<CXX_COMPILER_ID:GNU>:-m64 -Wall -Wextra -Werror -Wno-unused-function -Wno-deprecated-declarations -Wno-class-memaccess>
$<$<CXX_COMPILER_ID:GNU>:-m64 -Wall -Wextra -Werror -Wno-unused-function -Wno-deprecated-declarations -Wno-class-memaccess -Wno-deprecated-declarations>

#Add Clang specific compiler flags here
$<$<CXX_COMPILER_ID:Clang>:-m64 -Wall -Wextra -Werror -Wno-unused-function -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:Clang>:-m64 -Wall -Wextra -Werror -Wno-unused-function -Wno-deprecated-declarations -Wno-deprecated-copy -Wno-unused-parameter -Wno-unused-private-field -Wno-braced-scalar-init -Wno-unused-variable -Wno-unused-but-set-variable -Wno-deprecated-declarations >
)

set(MSVC_XCOMPILER_FLAGS "/openmp /std:c++17")
set(NeonCUDAFlags
# Optimization flags for Release
$<$<CXX_COMPILER_ID:GNU>: $<$<CONFIG:Release>:-O3> >
Expand All @@ -51,7 +52,7 @@ set(NeonCUDAFlags
# Host compiler
$<$<CXX_COMPILER_ID:GNU>:-Xcompiler -fopenmp -std=c++17 $<$<CONFIG:Release>:-O3> $<$<CONFIG:Debug>:-O0> >
$<$<CXX_COMPILER_ID:Clang>:-Xcompiler -fopenmp -std=c++17 $<$<CONFIG:Release>:-O3> $<$<CONFIG:Debug>:-O0>>
$<$<CXX_COMPILER_ID:MSVC>:-Xcompiler /std:c++17>
$<$<CXX_COMPILER_ID:MSVC>:-Xcompiler ${MSVC_XCOMPILER_FLAGS}>
#Disables warning
#177-D "function XXX was declared but never referenced"
-Xcudafe "--display_error_number --diag_suppress=177"
Expand Down
2 changes: 1 addition & 1 deletion cmake/Nvtx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ if (${NEON_USE_NVTX})
message(STATUS "NVTX Ranges is enabled")
else ()
message(STATUS "NVTX Ranges is disabled")
endif ()
endif ()
5 changes: 5 additions & 0 deletions libNeonCore/include/Neon/core/tools/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ LIBNEONCORE_EXPORT extern Logger LoggerObj;

} // namespace Neon

#if defined( NEON_ACTIVETE_TRACING)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this. If you want to turn the logging completely off you can just do Neon::globalSpace::LoggerObj.set_level(spdlog::level::off)

#define NEON_TRACE(...) ::Neon::globalSpace::LoggerObj.getLogger()->trace(__VA_ARGS__)
#else
#define NEON_TRACE(...)
#endif

#define NEON_INFO(...) ::Neon::globalSpace::LoggerObj.getLogger()->info(__VA_ARGS__)
#define NEON_WARNING(...) \
::Neon::globalSpace::LoggerObj.getLogger()->warn("Line {} File {}", __LINE__, __FILE__); \
Expand Down
10 changes: 7 additions & 3 deletions libNeonDomain/include/Neon/domain/interface/FieldBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Neon/core/tools/io/IODense.h"
#include "Neon/core/types/Macros.h"

#include "Neon/set/Containter.h"
#include "Neon/set/DataConfig.h"
#include "Neon/set/DevSet.h"
#include "Neon/set/HuOptions.h"
Expand All @@ -12,7 +13,6 @@
#include "GridBase.h"
#include "Neon/domain/interface/common.h"


namespace Neon::domain::interface {

template <typename T, int C>
Expand All @@ -25,8 +25,8 @@ class FieldBase

FieldBase();

FieldBase(const std::string fieldUserName,
const std::string fieldClassName,
FieldBase(const std::string& fieldUserName,
const std::string& fieldClassName,
const Neon::index_3d& dimension,
int cardinality,
T outsideVal,
Expand Down Expand Up @@ -57,6 +57,10 @@ class FieldBase
virtual auto haloUpdate(Neon::set::HuOptions& opt)
-> void = 0;

virtual auto haloUpdateContainer(Neon::set::TransferMode transferMode,
Neon::set::StencilSemantic stencilSemantic) const
-> Neon::set::Container;

auto getDimension() const
-> const Neon::index_3d&;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Neon/set/DataConfig.h"
#include "Neon/set/DevSet.h"
#include "Neon/set/MultiDeviceObjectInterface.h"
#include "Neon/set/MultiXpuDataInterface.h"
#include "Neon/set/memory/memSet.h"

#include "Neon/domain/interface/FieldBase.h"
Expand All @@ -21,7 +21,7 @@ template <typename T /** Field's cell metadata type */,
typename P /** Type of a Partition */,
typename S /** Storage type */>
class FieldBaseTemplate : public FieldBase<T, C>,
public Neon::set::interface::MultiDeviceObjectInterface<P, S>
public Neon::set::interface::MultiXpuDataInterface<P, S>
{
public:
using Partition = P;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ auto FieldBaseTemplate<T, C, G, P, S>::swapUIDBeforeFullSwap(FieldBaseTemplate::
NEON_THROW(exp);

}
Neon::set::interface::MultiDeviceObjectInterface<P, S>::swapUIDs(A,B);
Neon::set::interface::MultiXpuDataInterface<P, S>::swapUIDs(A,B);
}


Expand Down
11 changes: 9 additions & 2 deletions libNeonDomain/include/Neon/domain/interface/FieldBase_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ FieldBase<T, C>::FieldBase()
}

template <typename T, int C>
FieldBase<T, C>::FieldBase(const std::string FieldBaseUserName,
const std::string fieldClassName,
FieldBase<T, C>::FieldBase(const std::string& FieldBaseUserName,
const std::string& fieldClassName,
const Neon::index_3d& dimension,
int cardinality,
T outsideVal,
Expand Down Expand Up @@ -274,6 +274,13 @@ auto FieldBase<T, C>::getClassName() const -> const std::string&
return mStorage->className;
}

template <typename T, int C>
auto FieldBase<T, C>::haloUpdateContainer(Neon::set::TransferMode,
Neon::set::StencilSemantic) const -> Neon::set::Container
{
NEON_THROW_UNSUPPORTED_OPERATION("");
}

template <typename T, int C>
FieldBase<T, C>::Storage::Storage(const std::string FieldBaseUserName,
const std::string fieldClassName,
Expand Down
2 changes: 2 additions & 0 deletions libNeonDomain/include/Neon/domain/internal/bGrid/bGrid_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ auto bGrid::dot(const std::string& name,
return Neon::set::Container::factoryOldManaged(
name,
Neon::set::internal::ContainerAPI::DataViewSupport::on,
Neon::set::ContainerPatternType::reduction,
*this, [&](Neon::set::Loader& loader) {
loader.load(input1);
if (input1.getUid() != input2.getUid()) {
Expand Down Expand Up @@ -372,6 +373,7 @@ auto bGrid::norm2(const std::string& name,
return Neon::set::Container::factoryOldManaged(
name,
Neon::set::internal::ContainerAPI::DataViewSupport::on,
Neon::set::ContainerPatternType::reduction,
*this, [&](Neon::set::Loader& loader) {
loader.load(input);

Expand Down
12 changes: 9 additions & 3 deletions libNeonDomain/include/Neon/domain/internal/dGrid/dField.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class dField : public Neon::domain::interface::FieldBaseTemplate<T,

dField() = default;

~dField() = default;
virtual ~dField() = default;

auto self() -> Self&;

Expand All @@ -61,14 +61,18 @@ class dField : public Neon::domain::interface::FieldBaseTemplate<T,
auto haloUpdate(Neon::set::HuOptions& opt) const
-> void final;

auto haloUpdateContainer(Neon::set::TransferMode,
Neon::set::StencilSemantic)
const -> Neon::set::Container final;

auto haloUpdate(SetIdx setIdx, Neon::set::HuOptions& opt) const
-> void; //TODO add this function to the API if performance boost is reasonable -> void final;
-> void; // TODO add this function to the API if performance boost is reasonable -> void final;

auto haloUpdate(Neon::set::HuOptions& opt)
-> void final;

auto haloUpdate(SetIdx setIdx, Neon::set::HuOptions& opt)
-> void; //TODO add this function to the API if performance boost is reasonable -> void final;
-> void; // TODO add this function to the API if performance boost is reasonable -> void final;

virtual auto getReference(const Neon::index_3d& idx,
const int& cardinality)
Expand Down Expand Up @@ -188,4 +192,6 @@ class dField : public Neon::domain::interface::FieldBaseTemplate<T,
Neon::MemoryOptions mMemoryOptions;
};



} // namespace Neon::domain::internal::dGrid
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class dFieldDev

~dFieldDev() = default;

auto uid() const -> Neon::set::MultiDeviceObjectUid;
auto uid() const -> Neon::set::dataDependency::MultiXpuDataUid;

auto grid() -> grid_t&;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ auto dFieldDev<T, C>::operator=(dFieldDev&& other) -> dFieldDev&
}

template <typename T, int C>
auto dFieldDev<T, C>::uid() const -> Neon::set::MultiDeviceObjectUid
auto dFieldDev<T, C>::uid() const -> Neon::set::dataDependency::MultiXpuDataUid
{
void* addr = static_cast<void*>(m_data.get());
Neon::set::MultiDeviceObjectUid uidRes = (size_t)addr;
Neon::set::dataDependency::MultiXpuDataUid uidRes = (size_t)addr;
return uidRes;
}

Expand Down
60 changes: 59 additions & 1 deletion libNeonDomain/include/Neon/domain/internal/dGrid/dField_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ auto dField<T, C>::getPartition(Neon::Execution execution,
-> const Partition&
{
const Neon::DataUse dataUse = this->getDataUse();
bool isOk = Neon::ExecutionUtils::checkCompatibility(dataUse, execution);
bool isOk = Neon::ExecutionUtils::checkCompatibility(dataUse, execution);
if (isOk) {
if (execution == Neon::Execution::device) {
return m_gpu.getPartition(Neon::DeviceType::CUDA, setIdx, dataView);
Expand Down Expand Up @@ -438,6 +438,7 @@ template <typename T, int C>
auto dField<T, C>::haloUpdate(Neon::set::HuOptions& opt) const
-> void
{
NEON_TRACE("haloUpdate stream {} transferMode {} ", opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));
auto& bk = self().getBackend();
auto fieldDev = field(bk.devType());
switch (opt.transferMode()) {
Expand All @@ -458,13 +459,19 @@ auto dField<T, C>::haloUpdate(Neon::SetIdx setIdx,
Neon::set::HuOptions& opt) const
-> void
{


auto& bk = self().getBackend();
auto fieldDev = field(bk.devType());
switch (opt.transferMode()) {
case Neon::set::TransferMode::put:
NEON_TRACE("TRACE haloUpdate PUT setIdx {} stream {} transferMode {} ", setIdx.idx(), opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));

fieldDev.template haloUpdate<Neon::set::TransferMode::put>(setIdx, bk, -1, opt.startWithBarrier(), opt.streamSetIdx());
break;
case Neon::set::TransferMode::get:
NEON_TRACE("TRACE haloUpdate GET setIdx {} stream {} transferMode {} ", setIdx.idx(), opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));

fieldDev.template haloUpdate<Neon::set::TransferMode::get>(setIdx, bk, -1, opt.startWithBarrier(), opt.streamSetIdx());
break;
default:
Expand All @@ -477,6 +484,8 @@ template <typename T, int C>
auto dField<T, C>::haloUpdate(Neon::set::HuOptions& opt)
-> void
{
NEON_TRACE("haloUpdate stream {} transferMode {} ", opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));

auto& bk = self().getBackend();
auto fieldDev = field(bk.devType());
switch (opt.transferMode()) {
Expand All @@ -501,9 +510,17 @@ auto dField<T, C>::haloUpdate(Neon::SetIdx setIdx,
auto fieldDev = field(bk.devType());
switch (opt.transferMode()) {
case Neon::set::TransferMode::put:
#pragma omp critical
{
NEON_TRACE("TRACE haloUpdate PUT setIdx {} stream {} transferMode {} ", setIdx.idx(), opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));
}
fieldDev.template haloUpdate<Neon::set::TransferMode::put>(setIdx, bk, -1, opt.startWithBarrier(), opt.streamSetIdx());
break;
case Neon::set::TransferMode::get:
#pragma omp critical
{
NEON_TRACE("TRACE haloUpdate GET setIdx {} stream {} transferMode {} ", setIdx.idx(), opt.streamSetIdx(), Neon::set::TransferModeUtils::toString(opt.transferMode()));
}
fieldDev.template haloUpdate<Neon::set::TransferMode::get>(setIdx, bk, -1, opt.startWithBarrier(), opt.streamSetIdx());
break;
default:
Expand All @@ -512,6 +529,46 @@ auto dField<T, C>::haloUpdate(Neon::SetIdx setIdx,
}
}


template <typename T, int C>
auto dField<T, C>::
haloUpdateContainer(Neon::set::TransferMode transferMode,
Neon::set::StencilSemantic stencilSemantic)
const -> Neon::set::Container
{
Neon::set::Container dataTransferContainer =
Neon::set::Container::factoryDataTransfer(*this,
transferMode,
stencilSemantic);

Neon::set::Container SyncContainer =
Neon::set::Container::factorySynchronization(*this,
Neon::set::SynchronizationContainerType::hostOmpBarrier);
Neon::set::container::Graph graph(this->getBackend());
const auto& dataTransferNode = graph.addNode(dataTransferContainer);
const auto& syncNode = graph.addNode(SyncContainer);

switch (transferMode) {
case Neon::set::TransferMode::put:
graph.addDependency(dataTransferNode, syncNode, Neon::GraphDependencyType::data);
break;
case Neon::set::TransferMode::get:
graph.addDependency(syncNode, dataTransferNode, Neon::GraphDependencyType::data);
break;
default:
NEON_THROW_UNSUPPORTED_OPTION();
break;
}

graph.removeRedundantDependencies();

Neon::set::Container output =
Neon::set::Container::factoryGraph("dGrid-Halo-Update",
graph,
[](Neon::SetIdx, Neon::set::Loader&) {});
return output;
}

template <typename T, int C>
auto dField<T, C>::dot(Neon::set::patterns::BlasSet<T>& blasSet,
const dField<T>& input,
Expand Down Expand Up @@ -584,4 +641,5 @@ auto dField<T, C>::swap(dField::Field& A, dField::Field& B) -> void
std::swap(A, B);
}


} // namespace Neon::domain::internal::dGrid
6 changes: 3 additions & 3 deletions libNeonDomain/include/Neon/domain/internal/dGrid/dGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class dGrid : public Neon::domain::interface::GridBaseTemplate<dGrid, dCell>

dGrid(const dGrid& rhs) = default;

~dGrid() = default;
virtual ~dGrid() = default;

/**
* Constructor compatible with the general grid API
Expand Down Expand Up @@ -88,7 +88,7 @@ class dGrid : public Neon::domain::interface::GridBaseTemplate<dGrid, dCell>
* Creates a new Field
*/
template <typename T, int C = 0>
auto newField(const std::string fieldUserName,
auto newField(const std::string& fieldUserName,
int cardinality,
T inactiveValue,
Neon::DataUse dataUse = Neon::DataUse::IO_COMPUTE,
Expand Down Expand Up @@ -183,7 +183,7 @@ class dGrid : public Neon::domain::interface::GridBaseTemplate<dGrid, dCell>

Neon::index_3d halo;
std::vector<Neon::set::DataSet<PartitionIndexSpace>> partitionIndexSpaceVec;
Neon::sys::patterns::Engine reduceEngine;
Neon::sys::patterns::Engine reduceEngine;
};
std::shared_ptr<data_t> m_data;
};
Expand Down
Loading