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

Remove 2D and packing version from gcl #1233

Merged
merged 17 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
2 changes: 1 addition & 1 deletion docs_src/manuals/getting_started/code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12.4)

project(GridTools-laplacian LANGUAGES CXX)

find_package(GridTools 0.21.0 REQUIRED)
find_package(GridTools 0.22.0 REQUIRED)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not know why this is here...

Copy link
Contributor

Choose a reason for hiding this comment

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

If you merge with master, it should be gone.


add_executable(gt_laplacian test_gt_laplacian.cpp)
target_link_libraries(gt_laplacian GridTools::gridtools)
2 changes: 0 additions & 2 deletions include/gridtools/communication/GCL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ extern cudaStream_t XU_stream;

namespace gridtools {

enum packing_version { version_mpi_pack = 0, version_datatype, version_manual };

#ifdef GCL_MPI
extern MPI_Comm GCL_WORLD;
#else
Expand Down
139 changes: 37 additions & 102 deletions include/gridtools/communication/halo_exchange.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#include "high_level/descriptor_generic_manual.hpp"
#include "high_level/descriptors.hpp"
#include "high_level/descriptors_dt.hpp"
#include "high_level/descriptors_dt_whole.hpp"
#include "high_level/descriptors_fwd.hpp"
#include "high_level/descriptors_manual_gpu.hpp"

Expand Down Expand Up @@ -46,36 +44,6 @@ namespace gridtools {
return CartComm;
}

template <int D, typename GT, int version>
struct get_pattern;

template <typename GT>
struct get_pattern<3, GT, 0> {
typedef Halo_Exchange_3D<GT> type;
};

template <typename GT>
struct get_pattern<3, GT, 1> {
typedef Halo_Exchange_3D_DT<GT> type;
};

template <typename GT>
struct get_pattern<3, GT, 2> {
typedef Halo_Exchange_3D<GT> type;
};

template <int D>
struct get_grid;

template <>
struct get_grid<2> {
typedef MPI_3D_process_grid_t<2> type;
};

template <>
struct get_grid<3> {
typedef MPI_3D_process_grid_t<3> type;
};
} // namespace _impl

/**
Expand Down Expand Up @@ -229,14 +197,14 @@ namespace gridtools {
/**
Type of the computin grid associated to the pattern
*/
/*typedef typename _impl::get_grid<DIMS>::type grid_type;*/
typedef GridType grid_type;
static const uint_t DIMS = GridType::ndims;

static constexpr int DIMS = 3;

/**
Type of the Level 3 pattern used. This is available only if the pattern uses a Level 3 pattern.
mbianco marked this conversation as resolved.
Show resolved Hide resolved
In the case the implementation is not using L3, the type is not available.
*/
typedef typename _impl::get_pattern<DIMS, grid_type, version>::type pattern_type;
typedef Halo_Exchange_3D<grid_type> pattern_type;

private:
template <typename Array>
Expand All @@ -250,7 +218,7 @@ namespace gridtools {
return CartComm;
}

typedef hndlr_dynamic_ut<DataType, GridType, pattern_type, layout2proc_map, Gcl_Arch, version> hd_t;
typedef hndlr_dynamic_ut<DataType, GridType, pattern_type, layout2proc_map, Gcl_Arch> hd_t;

hd_t hd;

Expand Down Expand Up @@ -289,27 +257,27 @@ namespace gridtools {

/** constructor that takes the periodicity (mathich the \link
boollist_concept \endlink concept, and the MPI CART
communicator in DIMS (specified as template argument to the
pattern) dimensions of the processing grid. the periodicity is
specified in the order chosen by the programmer for the data,
as in the rest of the application. It is up tp the
construnctor implementation to translate it into the right
order depending on the gridtools::layout_map passed to the class.
communicator in 3 dimensions of the processing grid. the
periodicity is specified in the order chosen by the
programmer for the data, as in the rest of the
application. It is up tp the construnctor implementation
mbianco marked this conversation as resolved.
Show resolved Hide resolved
to translate it into the right order depending on the
gridtools::layout_map passed to the class.

\param[in] c Periodicity specification as in \link boollist_concept \endlink
\param[in] comm MPI CART communicator with dimension DIMS (specified as template argument to the pattern).
\param[in] comm MPI CART communicator with dimension 3
*/
explicit halo_exchange_dynamic_ut(typename grid_type::period_type const &c, MPI_Comm const &comm)
: hd(c.template permute<layout2proc_map_abs>(), comm) {}

/** constructor that takes the periodicity (mathich the \link
boollist_concept \endlink concept, and the MPI CART
communicator in DIMS (specified as template argument to the
pattern) dimensions of the processing grid. the periodicity is
specified in the order chosen by the programmer for the data,
as in the rest of the application. It is up tp the
construnctor implementation to translate it into the right
order depending on the gridtools::layout_map passed to the class.
communicator in 3 dimensions of the processing grid. the
periodicity is specified in the order chosen by the
programmer for the data, as in the rest of the
application. It is up tp the construnctor implementation
mbianco marked this conversation as resolved.
Show resolved Hide resolved
to translate it into the right order depending on the
gridtools::layout_map passed to the class.

Examples:
1) hd(period_type(true, true, false), MPI_COMM_WORLD, array<int, 3>{0,0,0});
Expand All @@ -325,7 +293,7 @@ namespace gridtools {
\tparam ValueType Value type of the GridTools array of dimensions (deduced)
\tparam Size Size of the GridTools array of dimensions (deduced)
\param[in] c Periodicity specification as in \link boollist_concept \endlink
\param[in] comm MPI CART communicator with dimension DIMS (specified as template argument to the pattern).
\param[in] comm MPI CART communicator with dimension 3
\param[in] dims Array of dimensions of the ocmputing grid. Array must provide operator[] up to 3 elements.
The behavior is like MPI_Dims_create.
*/
Expand All @@ -344,7 +312,7 @@ namespace gridtools {
\tparam ValueType Value type of the GridTools array of dimensions (deduced)
\tparam Size Size of the GridTools array of dimensions (deduced)
\param[in] c Periodicity specification as in \link boollist_concept \endlink
\param[in] comm MPI CART communicator with dimension DIMS (specified as template argument to the pattern).
\param[in] comm MPI CART communicator with dimension 3
\param[in] dims Array of dimensions of the ocmputing grid. Array must provide operator[] up to 3 elements.
The behavior is like MPI_Dims_create.
*/
Expand Down Expand Up @@ -550,19 +518,6 @@ namespace gridtools {
grid_type const &comm() const { return hd.comm(); }
};

template <int I>
struct pick_version;

template <>
struct pick_version<2> {
static const int value = gridtools::version_mpi_pack;
};

template <>
struct pick_version<3> {
static const int value = gridtools::version_manual;
};

/**
This is the main class for the halo exchange pattern in the case
in which the data pointers, data types, and shapes are not known
Expand All @@ -588,25 +543,26 @@ namespace gridtools {
\tparam GCL_ARCH Specification of the "architecture", that is the place where the data to be exchanged is.
Possible coiches are defined in low_level/gcl_arch.h .
*/
template <typename layout2proc_map, int DIMS, typename Gcl_Arch = gcl_cpu, int version = pick_version<DIMS>::value>
template <typename layout2proc_map, typename Gcl_Arch>
class halo_exchange_generic_base {

public:
// typedef typename reverse_map<t_layout2proc_map>::type layout2proc_map;

static constexpr int DIMS = 3;

/**
Type of the computin grid associated to the pattern
*/
typedef typename _impl::get_grid<DIMS>::type grid_type;
typedef MPI_3D_process_grid_t<3> grid_type;

/**
Type of the Level 3 pattern used. This is available only if the pattern uses a Level 3 pattern.
In the case the implementation is not using L3, the type is not available.
*/
typedef typename _impl::get_pattern<DIMS, grid_type, version>::type pattern_type;
typedef Halo_Exchange_3D<grid_type> pattern_type;

private:
hndlr_generic<DIMS, pattern_type, layout2proc_map, Gcl_Arch, version> hd;
hndlr_generic<pattern_type, layout2proc_map, Gcl_Arch> hd;

public:
/** constructor that takes the periodicity (matching the \link
Expand Down Expand Up @@ -722,37 +678,17 @@ namespace gridtools {
void wait() { hd.wait(); }
};

template <typename layout2proc_map, int DIMS, typename Gcl_Arch = gcl_cpu, int version = version_manual>
class halo_exchange_generic : public halo_exchange_generic_base<layout2proc_map, DIMS, Gcl_Arch, version> {

typedef halo_exchange_generic_base<layout2proc_map, DIMS, Gcl_Arch, version> base_type;
// typedef typename layout_transform<layout_map, layout2proc_map_abs>::type layout2proc_map;

public:
typedef typename base_type::grid_type grid_type;

typedef typename base_type::pattern_type pattern_type;

template <typename DT>
struct traits {
static const int I = DIMS;
typedef empty_field<DT, I> base_field;
};

explicit halo_exchange_generic(typename grid_type::period_type const &c, MPI_Comm comm) : base_type(c, comm) {}

explicit halo_exchange_generic(grid_type const &g) : base_type(g) {}
};
template <typename layout2proc_map, typename Gcl_Arch = gcl_cpu>
class halo_exchange_generic;

// different traits are needed
template <typename layout2proc_map, int DIMS>
class halo_exchange_generic<layout2proc_map, DIMS, gcl_cpu, version_manual>
: public halo_exchange_generic_base<layout2proc_map, DIMS, gcl_cpu, version_manual> {
template <typename layout2proc_map>
class halo_exchange_generic<layout2proc_map, gcl_cpu>
: public halo_exchange_generic_base<layout2proc_map, gcl_cpu> {

static const int version = version_manual;
typedef gcl_cpu Gcl_Arch;

typedef halo_exchange_generic_base<layout2proc_map, DIMS, gcl_cpu, version_manual> base_type;
typedef halo_exchange_generic_base<layout2proc_map, gcl_cpu> base_type;

public:
typedef typename base_type::grid_type grid_type;
Expand All @@ -761,8 +697,8 @@ namespace gridtools {

template <typename DT>
struct traits {
static const int I = DIMS;
typedef empty_field_no_dt<I> base_field;
static const int I = 3;
typedef empty_field_no_dt base_field;
};

explicit halo_exchange_generic(typename grid_type::period_type const &c, MPI_Comm comm) : base_type(c, comm) {}
Expand All @@ -772,13 +708,12 @@ namespace gridtools {

// different traits are needed
template <typename layout2proc_map>
class halo_exchange_generic<layout2proc_map, 3, gcl_gpu, version_manual>
: public halo_exchange_generic_base<layout2proc_map, 3, gcl_gpu, version_manual> {
class halo_exchange_generic<layout2proc_map, gcl_gpu>
: public halo_exchange_generic_base<layout2proc_map, gcl_gpu> {
static const int DIMS = 3;

static const int version = version_manual;
typedef gcl_gpu Gcl_Arch;
typedef halo_exchange_generic_base<layout2proc_map, DIMS, gcl_gpu, version_manual> base_type;
typedef halo_exchange_generic_base<layout2proc_map, gcl_gpu> base_type;

public:
typedef typename base_type::grid_type grid_type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
namespace gridtools {

template <typename HaloExch, typename proc_layout_abs>
class hndlr_generic<3, HaloExch, proc_layout_abs, gcl_cpu, version_manual> : public descriptor_base<HaloExch> {
class hndlr_generic<HaloExch, proc_layout_abs, gcl_cpu> : public descriptor_base<HaloExch> {
static const int DIMS = 3;
gridtools::array<char *, _impl::static_pow3<DIMS>::value> send_buffer; // One entry will not be used...
gridtools::array<char *, _impl::static_pow3<DIMS>::value> recv_buffer;
Expand Down Expand Up @@ -381,7 +381,7 @@ namespace gridtools {

#ifdef __CUDACC__
template <typename HaloExch, typename proc_layout_abs>
class hndlr_generic<3, HaloExch, proc_layout_abs, gcl_gpu, version_manual> : public descriptor_base<HaloExch> {
class hndlr_generic<HaloExch, proc_layout_abs, gcl_gpu> : public descriptor_base<HaloExch> {
typedef gcl_gpu arch_type;

static const int DIMS = 3;
Expand Down
Loading