Skip to content

Fix redefinition issue related to HIP's ::min#1974

Open
etiennemlb wants to merge 1 commit intoginkgo-project:developfrom
etiennemlb:develop
Open

Fix redefinition issue related to HIP's ::min#1974
etiennemlb wants to merge 1 commit intoginkgo-project:developfrom
etiennemlb:develop

Conversation

@etiennemlb
Copy link

  • Pushed min/max difinitions into the detail namespace
  • renamed min/max to do_min and do_max

On a Cray machine, using:

module load cpe/24.07
module load craype-accel-amd-gfx90a craype-x86-trento
module load PrgEnv-amd
module load amd/6.4.3
module load rocm/6.4.3
module load cmake ninja

cmake .. -G Ninja \
    -DCMAKE_CXX_COMPILER=CC -DCMAKE_C_COMPILER=cc -DCMAKE_HIP_COMPILER="CC" \
    -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS=gfx90a -DCMAKE_HIP_ARCHITECTURES=gfx90a \
    -DGINKGO_BUILD_HIP=ON \
    -DGINKGO_BUILD_OMP=ON \
    -DGINKGO_BUILD_MPI=ON -DGINKGO_FORCE_GPU_AWARE_MPI=ON \
    -DGINKGO_BUILD_EXAMPLES=OFF -DGINKGO_BUILD_TESTS=ON \
    -DGINKGO_BUILD_BENCHMARKS=ON -DGINKGO_BENCHMARK_ENABLE_TUNING=OFF \
    -DGINKGO_MIXED_PRECISION=OFF -DGINKGO_ENABLE_BFLOAT16=OFF -DGINKGO_ENABLE_HALF=OFF \
    -DGINKGO_BUILD_HWLOC=OFF -DGINKGO_BUILD_PAPI_SDE=OFF -DGINKGO_WITH_CCACHE=OFF

All builds fine except for ginkgo/core/test/mpi/base/bindings.cpp which fails with:

ginkgo/core/test/mpi/base/bindings.cpp:56:7: error: redefinition of 'min' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:59:7: error: explicit specialization of non-template class 'min'
ginkgo/core/test/mpi/base/bindings.cpp:59:7: error: redefinition of 'min' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:66:7: error: explicit specialization of non-template class 'min'
ginkgo/core/test/mpi/base/bindings.cpp:66:7: error: redefinition of 'min' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:92:7: error: redefinition of 'max' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:95:7: error: explicit specialization of non-template class 'max'
ginkgo/core/test/mpi/base/bindings.cpp:95:7: error: redefinition of 'max' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:102:7: error: explicit specialization of non-template class 'max'
ginkgo/core/test/mpi/base/bindings.cpp:102:7: error: redefinition of 'max' as different kind of symbol
ginkgo/core/test/mpi/base/bindings.cpp:139:5: error: no template named 'max'
ginkgo/core/test/mpi/base/bindings.cpp:140:5: error: no template named 'min'
ginkgo/core/test/mpi/base/bindings.cpp:133:22: error: unexpected type name 'value_type': expected expression
ginkgo/core/test/mpi/base/bindings.cpp:133:34: error: expected expression
ginkgo/core/test/mpi/base/bindings.cpp:134:22: error: unexpected type name 'value_type': expected expression
ginkgo/core/test/mpi/base/bindings.cpp:134:34: error: expected expression
ginkgo/core/test/mpi/base/bindings.cpp:149:1: error: only virtual member functions can be marked 'override'
ginkgo/build/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h:448:40: error: cannot initialize return object of type 'Test *' with an rvalue of type 'MpiBindings_CanSetADefaultwindow_Test<double> *'
ginkgo/core/test/mpi/base/bindings.cpp:149:1: error: only virtual member functions can be marked 'override'

Min/max are already present at line LEET in ROCm 6.4.3 at least:

/opt/rocm/6.4.3/lib/llvm/lib/clang/19/include/__clang_hip_math.h:1337:8: note: previous definition is here
 1337 | double min(double __x, double __y) { return __builtin_fmin(__x, __y); }

+ Pushed min/max difinitions into the detail namespace
+ renamed min/max to do_min and do_max
Copy link
Member

@yhmtsai yhmtsai left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants