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

Fixes for CUDA 12.4, METIS #1569

Merged
merged 7 commits into from
Apr 9, 2024
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
6 changes: 0 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ test/cuda110/mvapich2/gcc/cuda/debug/shared:
SLURM_GRES: "gpu:4"
SLURM_TIME: "02:00:00"
dependencies: null
# FIXME: current slurm always reports failure even if all tests are passed.
allow_failure: yes
needs: [ "build/cuda110/mvapich2/gcc/cuda/debug/shared" ]


Expand Down Expand Up @@ -295,8 +293,6 @@ test/cuda110/nompi/clang/cuda/release/static:
SLURM_GRES: "gpu:4"
SLURM_TIME: "01:30:00"
dependencies: null
# FIXME: current slurm always reports failure even if all tests are passed.
allow_failure: yes
needs: [ "build/cuda110/nompi/clang/cuda/release/static" ]


Expand Down Expand Up @@ -331,8 +327,6 @@ test/cuda110/nompi/intel/cuda/debug/static:
SLURM_GRES: "gpu:4"
SLURM_TIME: "02:00:00"
dependencies: null
# FIXME: current slurm always reports failure even if all tests are passed.
allow_failure: yes
needs: [ "build/cuda110/nompi/intel/cuda/debug/static" ]


Expand Down
3 changes: 2 additions & 1 deletion .gitlab/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
# build to test
- cd ${CI_PROJECT_DIR}${CI_PROJECT_DIR_SUFFIX}
- cd ${CI_JOB_NAME/test/build}
- export INSTALL_PREFIX=`pwd`/install_prefix
- |
(( $(ctest -N | tail -1 | sed 's/Total Tests: //') != 0 )) || exit 1
- ctest --output-on-failure --timeout 6000 ${CTEST_EXTRA_ARGS}
Expand All @@ -135,7 +136,7 @@
- pushd test/test_install
- ninja install
- popd
- LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ninja test_pkgconfig
- PKG_CONFIG_PATH=${INSTALL_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH ninja test_pkgconfig
cache: []


Expand Down
5 changes: 5 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ packages can be turned off by disabling the relevant options.
+ GINKGO_BUILD_DOC=ON:
[doxygen](https://www.doxygen.nl/) is required to build the documentation and
additionally [graphviz](https://graphviz.org/) is required to build the class hierarchy graphs.
+ [METIS](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview) is required
when using the `NestedDissection` reordering functionality.
If METIS is not found, the functionality is disabled.
+ [PAPI](https://icl.utk.edu/papi/) (>= 7.1.0) is required when using the `Papi` logger.
If PAPI is not found, the functionality is disabled.

Ginkgo attempts to use pre-installed versions of these package if they match
version requirements using `find_package`. Otherwise, the configuration step
Expand Down
18 changes: 17 additions & 1 deletion cmake/Modules/FindMETIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,24 @@ if (METIS_INCLUDE_DIR)
string(REGEX REPLACE "^#define[\t ]+METIS_VER_MINOR[\t ]+([0-9]+).*" "\\1" METIS_VERSION_MINOR "${metis_version_str_minor}")
set(METIS_VERSION ${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR})
find_library(METIS_LIBRARY ${METIS_LIB_NAME} HINTS ${METIS_DIR} ENV METIS_DIR PATH_SUFFIXES lib lib64)
if (METIS_VERSION VERSION_GREATER_EQUAL 5.0)
find_library(METIS_GKLIB_LIBRARY GKlib HINTS ${METIS_DIR} ENV METIS_DIR PATH_SUFFIXES lib lib64)
else()
# set it to a non-empty value to satisfy find_package_handle_standard_args
set(METIS_GKLIB_LIBRARY libGKlib.so)
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(METIS REQUIRED_VARS METIS_LIBRARY METIS_INCLUDE_DIR VERSION_VAR METIS_VERSION)
find_package_handle_standard_args(METIS REQUIRED_VARS METIS_LIBRARY METIS_GKLIB_LIBRARY METIS_INCLUDE_DIR VERSION_VAR METIS_VERSION)

if(METIS_FOUND)
set(METIS_LIBRARIES ${METIS_LIBRARY})
set(METIS_GKLIB_LIBRARIES ${METIS_GKLIB_LIBRARY})
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
unset(METIS_LIBRARY)
unset(METIS_INCLUDE_DIR)
unset(METIS_GKLIB_LIBRARY)

if(NOT TARGET METIS::METIS)
add_library(METIS::METIS UNKNOWN IMPORTED)
Expand All @@ -63,5 +71,13 @@ if(METIS_FOUND)
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${METIS_LIBRARIES}")
if (METIS_VERSION VERSION_GREATER_EQUAL 5.0)
add_library(METIS::GKlib UNKNOWN IMPORTED)
set_target_properties(METIS::GKlib PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${METIS_GKLIB_LIBRARIES}")
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES METIS::GKlib)
endif()
endif()
endif()
5 changes: 3 additions & 2 deletions common/cuda_hip/base/device_matrix_data_kernels.hpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ void sum_duplicates(std::shared_ptr<const DefaultExecutor> exec, size_type,
array<IndexType>& col_idxs)
{
const auto size = values.get_size();
const auto rows = row_idxs.get_const_data();
const auto cols = col_idxs.get_const_data();
// CUDA 12.4 has a bug that requires these pointers to be non-const
const auto rows = row_idxs.get_data();
const auto cols = col_idxs.get_data();
auto iota = thrust::make_counting_iterator(size_type{});
const auto new_size = static_cast<size_type>(thrust::count_if(
thrust_policy(exec), iota, iota + size,
Expand Down
7 changes: 5 additions & 2 deletions common/cuda_hip/multigrid/pgm_kernels.hpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ void compute_coarse_coo(std::shared_ptr<const DefaultExecutor> exec,
matrix::Coo<ValueType, IndexType>* coarse_coo)
{
auto vals_it = as_device_type(vals);
auto key_it =
thrust::make_zip_iterator(thrust::make_tuple(row_idxs, col_idxs));
// this const_cast is necessary as a workaround for CCCL bug
// https://github.com/NVIDIA/cccl/issues/1527
// shipped with CUDA 12.4
auto key_it = thrust::make_zip_iterator(thrust::make_tuple(
const_cast<IndexType*>(row_idxs), const_cast<IndexType*>(col_idxs)));

auto coarse_vals_it = as_device_type(coarse_coo->get_values());
auto coarse_key_it = thrust::make_zip_iterator(thrust::make_tuple(
Expand Down
2 changes: 1 addition & 1 deletion reference/test/reorder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(GINKGO_HAVE_METIS)
ginkgo_create_test(nested_dissection)
ginkgo_create_test(nested_dissection ADDITIONAL_LIBRARIES METIS::METIS)
endif()
ginkgo_create_test(rcm)
ginkgo_create_test(rcm_kernels)
Expand Down
Loading