When building heffte +cuda, the package silently builds with GPU-aware MPI enabled because heFFTe's CMakeLists.txt automatically turns on Heffte_ENABLE_GPU_AWARE_MPI=ON if accelerators are present. If the underlying ^mpi provider was not compiled with CUDA/ROCm support, this causes a silent compilation success followed by a hard segmentation fault at runtime whenever MPI attempts to touch the device pointers (e.g. inside MPI_Alltoallv).
Failed test execution and GDB Backtrace
root@c2e41f2e3b42:~/testsuite/validation_tests/heffte-cuda/build# which gdb
/spack/opt/spack/linux-ppc64le/gdb-17.1-n4d2fqkkilos6eyml2xdygvngpy2bmma/bin/gdb
root@c2e41f2e3b42:~/testsuite/validation_tests/heffte-cuda/build# /opt/mpi/pkgs/mpich-5.0.1/bin/mpiexec -n 2 -l ./examples/heffte_example_gpu
===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 89504 RUNNING AT c2e41f2e3b42
= EXIT CODE: 139
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions
root@c2e41f2e3b42:/testsuite/validation_tests/heffte-cuda/build# /opt/mpi/pkgs/mpich-5.0.1/bin/mpiexec -n 2 bash -c 'echo "rank $PMI_RANK / $MPI_LOCALRANKID sees devices: $CUDA_VISIBLE_DEVICES"'
rank 0 / 0 sees devices:
rank 1 / 1 sees devices:
root@c2e41f2e3b42:/testsuite/validation_tests/heffte-cuda/build# /opt/mpi/pkgs/mpich-5.0.1/bin/mpiexec -n 2 gdb -q -batch -ex run -ex bt --args ./examples/heffte_example_gpu 2>&1 | tail -60
warning: Error disabling address space randomization: Operation not permitted
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/powerpc64le-linux-gnu/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/powerpc64le-linux-gnu/libthread_db.so.1".
[New Thread 0x7fff9b73a890 (LWP 89545)]
[New Thread 0x7fff7bf3a890 (LWP 89544)]
[New Thread 0x7fff9af2a890 (LWP 89546)]
[New Thread 0x7fff7b72a890 (LWP 89547)]
[New Thread 0x7fff9764a890 (LWP 89548)]
[New Thread 0x7fff77e4a890 (LWP 89549)]
[New Thread 0x7fff9692a890 (LWP 89550)]
[New Thread 0x7fff7712a890 (LWP 89551)]
Thread 1 "heffte_example_" received signal SIGSEGV, Segmentation fault.
0x00007fff9bdefd5c in ?? () from /usr/lib/powerpc64le-linux-gnu/libc.so.6
Thread 1 "heffte_example_" received signal SIGSEGV, Segmentation fault.
0x00007fff7c5efd5c in ?? () from /usr/lib/powerpc64le-linux-gnu/libc.so.6
#0 0x00007fff9bdefd5c in ?? () from /usr/lib/powerpc64le-linux-gnu/libc.so.6
#0 0x00007fff7c5efd5c in ?? () from /usr/lib/powerpc64le-linux-gnu/libc.so.6
#1 0x00007fffb2550a4c in typerep_do_pack.part () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#1 0x00007fff92d50a4c in typerep_do_pack.part () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#2 0x00007fffb2550e68 in MPIR_Typerep_pack () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#2 0x00007fff92d50e68 in MPIR_Typerep_pack () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#3 0x00007fffb25127e0 in MPIDI_POSIX_eager_send () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#3 0x00007fff92d127e0 in MPIDI_POSIX_eager_send () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#4 0x00007fffb251aa24 in MPIDI_POSIX_mpi_isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#4 0x00007fff92d1aa24 in MPIDI_POSIX_mpi_isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#5 0x00007fffb251afbc in MPID_Isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#5 0x00007fff92d1afbc in MPID_Isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#6 0x00007fffb2525eb4 in MPIC_Isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#6 0x00007fff92d25eb4 in MPIC_Isend () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#7 0x00007fffb24436f8 in MPIR_Alltoallv_intra_scattered () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#7 0x00007fff92c436f8 in MPIR_Alltoallv_intra_scattered () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#8 0x00007fffb24f654c in MPIR_Alltoallv_allcomm_auto () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#8 0x00007fff92cf654c in MPIR_Alltoallv_allcomm_auto () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#9 0x00007fffb24f693c in MPIR_Alltoallv_impl () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#9 0x00007fff92cf693c in MPIR_Alltoallv_impl () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#10 0x00007fffb24f6ecc in MPIR_Alltoallv () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#10 0x00007fff92cf6ecc in MPIR_Alltoallv () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#11 0x00007fffb21307fc in PMPI_Alltoallv () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#11 0x00007fff929307fc in PMPI_Alltoallv () from /opt/mpi/pkgs/mpich-5.0.1/lib/libmpi.so.12
#12 0x00007fffb349ad70 in void heffte::reshape3d_alltoallv<heffte::tag::gpu, heffte::direct_packer, int>::apply_base<std::complex >(int, std::complex const*, std::complex, std::complex) const () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#12 0x00007fff93c9ad70 in void heffte::reshape3d_alltoallv<heffte::tag::gpu, heffte::direct_packer, int>::apply_base<std::complex >(int, std::complex const*, std::complex, std::complex) const () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#13 0x00007fffb349af48 in heffte::reshape3d_alltoallv<heffte::tag::gpu, heffte::direct_packer, int>::apply(int, std::complex const*, std::complex, std::complex) const () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#13 0x00007fff93c9af48 in heffte::reshape3d_alltoallv<heffte::tag::gpu, heffte::direct_packer, int>::apply(int, std::complex const*, std::complex, std::complex) const () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#14 0x00007fffb34bc2b0 in void heffte::compute_transform<heffte::tag::gpu, int, std::complex >(heffte::backend::data_manipulatorheffte::tag::gpu::stream_type, int, std::complex const*, std::complex, std::complex, unsigned long, unsigned long, std::array<std::unique_ptr<heffte::reshape3d_base, std::default_delete<heffte::reshape3d_base > >, 4ul> const&, std::array<heffte::executor_base*, 3ul> const&, heffte::direction) () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#14 0x00007fff93cbc2b0 in void heffte::compute_transform<heffte::tag::gpu, int, std::complex >(heffte::backend::data_manipulatorheffte::tag::gpu::stream_type, int, std::complex const*, std::complex, std::complex, unsigned long, unsigned long, std::array<std::unique_ptr<heffte::reshape3d_base, std::default_delete<heffte::reshape3d_base > >, 4ul> const&, std::array<heffte::executor_base*, 3ul> const&, heffte::direction) () from /spack/opt/spack/linux-ppc64le/heffte-2.4.1-32vnlrwrxgayecp235i5ljmdu77dzziw/lib/libheffte.so.2
#15 0x0000000133dba438 in void heffte::fft3d<heffte::backend::cufft, int>::forward<std::complex, std::complex >(std::complex const*, std::complex, std::complex, heffte::scale) const ()
#15 0x0000000102e6a438 in void heffte::fft3d<heffte::backend::cufft, int>::forward<std::complex, std::complex >(std::complex const*, std::complex, std::complex, heffte::scale) const ()
#16 0x0000000133db627c in compute_dft(int) ()
#16 0x0000000102e6627c in compute_dft(int) ()
#17 0x0000000133db66ac in main ()
#17 0x0000000102e666ac in main ()
When building heffte +cuda, the package silently builds with GPU-aware MPI enabled because heFFTe's CMakeLists.txt automatically turns on Heffte_ENABLE_GPU_AWARE_MPI=ON if accelerators are present. If the underlying ^mpi provider was not compiled with CUDA/ROCm support, this causes a silent compilation success followed by a hard segmentation fault at runtime whenever MPI attempts to touch the device pointers (e.g. inside MPI_Alltoallv).
Possible fixes:
Example of failing heffte+cuda spec
Failed test execution and GDB Backtrace
@G-Ragghianti @mkstoyanov @eugeneswalker