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

Allow passing smart pointers to functions directly (interface changes only) #1279

Merged
merged 9 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ endif()
set(GINKGO_HAVE_GPU_AWARE_MPI OFF)
set(GINKGO_FORCE_SPMV_BLOCKING_COMM OFF)
if(GINKGO_BUILD_MPI)
find_package(MPI REQUIRED)
find_package(MPI 3.1 COMPONENTS CXX REQUIRED)
if(GINKGO_FORCE_GPU_AWARE_MPI)
set(GINKGO_HAVE_GPU_AWARE_MPI ON)
else()
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ The Ginkgo DPC++ module has the following __additional__ requirements:
* oneMKL
* oneDPL

The Ginkgo MPI module has the following __additional__ requirements:

* MPI 3.1+, ideally with GPUDirect support for best performance

In addition, if you want to contribute code to Ginkgo, you will also need the
following:

Expand Down
2 changes: 1 addition & 1 deletion cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ endif()

# Check for MPI if it is enabled
if(GINKGO_BUILD_MPI)
find_package(MPI REQUIRED)
find_package(MPI 3.1 COMPONENTS CXX REQUIRED)
endif()

# HIP and OpenMP depend on Threads::Threads in some circumstances, but don't find it
Expand Down
2 changes: 1 addition & 1 deletion cmake/autodetect_executors.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (NOT DEFINED GINKGO_BUILD_OMP)
endif()

if (NOT DEFINED GINKGO_BUILD_MPI)
find_package(MPI 3.1)
find_package(MPI 3.1 COMPONENTS CXX)
if(MPI_FOUND)
message(STATUS "Enabling MPI support")
set(GINKGO_HAS_MPI ON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/create_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function(ginkgo_create_gtest_mpi_main)
target_sources(gtest_mpi_main
PRIVATE
${PROJECT_SOURCE_DIR}/core/test/mpi/gtest/mpi_listener.cpp)
find_package(MPI REQUIRED)
find_package(MPI 3.1 COMPONENTS CXX REQUIRED)
target_link_libraries(gtest_mpi_main PRIVATE GTest::GTest MPI::MPI_CXX)
endfunction(ginkgo_create_gtest_mpi_main)

Expand Down
23 changes: 14 additions & 9 deletions core/distributed/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ Matrix<ValueType, LocalIndexType, GlobalIndexType>::Matrix(
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
Matrix<ValueType, LocalIndexType, GlobalIndexType>::Matrix(
std::shared_ptr<const Executor> exec, mpi::communicator comm,
const LinOp* local_matrix_type)
: Matrix(exec, comm, local_matrix_type, local_matrix_type)
ptr_param<const LinOp> local_matrix_template)
: Matrix(exec, comm, local_matrix_template, local_matrix_template)
{}


template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
Matrix<ValueType, LocalIndexType, GlobalIndexType>::Matrix(
std::shared_ptr<const Executor> exec, mpi::communicator comm,
const LinOp* local_matrix_template, const LinOp* non_local_matrix_template)
ptr_param<const LinOp> local_matrix_template,
ptr_param<const LinOp> non_local_matrix_template)
: EnableDistributedLinOp<
Matrix<value_type, local_index_type, global_index_type>>{exec},
DistributedBase{comm},
Expand Down Expand Up @@ -141,8 +142,10 @@ void Matrix<ValueType, LocalIndexType, GlobalIndexType>::move_to(
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
const device_matrix_data<value_type, global_index_type>& data,
const Partition<local_index_type, global_index_type>* row_partition,
const Partition<local_index_type, global_index_type>* col_partition)
ptr_param<const Partition<local_index_type, global_index_type>>
row_partition,
ptr_param<const Partition<local_index_type, global_index_type>>
col_partition)
{
const auto comm = this->get_communicator();
GKO_ASSERT_EQ(data.get_size()[0], row_partition->get_size());
Expand Down Expand Up @@ -228,8 +231,10 @@ void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
const matrix_data<value_type, global_index_type>& data,
const Partition<local_index_type, global_index_type>* row_partition,
const Partition<local_index_type, global_index_type>* col_partition)
ptr_param<const Partition<local_index_type, global_index_type>>
row_partition,
ptr_param<const Partition<local_index_type, global_index_type>>
col_partition)
{
this->read_distributed(
device_matrix_data<value_type, global_index_type>::create_from_host(
Expand All @@ -241,7 +246,7 @@ void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
const matrix_data<ValueType, global_index_type>& data,
const Partition<local_index_type, global_index_type>* partition)
ptr_param<const Partition<local_index_type, global_index_type>> partition)
{
this->read_distributed(
device_matrix_data<value_type, global_index_type>::create_from_host(
Expand All @@ -253,7 +258,7 @@ void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
void Matrix<ValueType, LocalIndexType, GlobalIndexType>::read_distributed(
const device_matrix_data<ValueType, GlobalIndexType>& data,
const Partition<local_index_type, global_index_type>* partition)
ptr_param<const Partition<local_index_type, global_index_type>> partition)
{
this->read_distributed(data, partition, partition);
}
Expand Down
Loading