Skip to content

Commit

Permalink
Merge #6369
Browse files Browse the repository at this point in the history
6369: working issue with MPI_CC / CC conflict in automake r=hkaiser a=ct-clmsn

Fixes #

An issue with MPI_CC/CC conflict with gasnet-conduit-mpi autotools (autoconf in gasnet).

## Proposed Changes

  - set MPI_CC to the user set CMAKE_C_COMPILER
  - set ENV{MPI_CC} to CMAKE_C_COMPILER
  - set MPI_C_COMPILER to CMAKE_C_COMPILER
  
## Any background context you want to provide?

When gasnet compiles it automatically detects for mpi. If it finds MPI then MPI_CC is set. If MPI_CC is set to a compiler that does not match the CMAKE_C_COMPILER set by a user to compile gasnet, then a runtime exception happens during gasnet's build.

## Checklist

Not all points below apply to all pull requests.

- [ ] I have added a new feature and have added tests to go along with it.
- [ ] I have fixed a bug and have added a regression test.
- [ ] I have added a test using random numbers; I have made sure it uses a seed, and that random numbers generated are valid inputs for the tests.


Co-authored-by: ct-clmsn <[email protected]>
  • Loading branch information
StellarBot and ct-clmsn committed Oct 17, 2023
2 parents 53e9a95 + bd490d2 commit 103a7b8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmake/HPX_SetupGasnet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,23 @@ macro(hpx_setup_gasnet)
endif()

if(${MPI_C_COMPILER})
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
set(MPI_C_COMPILER ${CMAKE_C_COMPILER})
set(MPI_CC ${CMAKE_C_COMPILER})
set(ENV{MPI_CC} ${CMAKE_C_COMPILER})
elseif(${MPI_CC})
set(CMAKE_C_COMPILER ${MPI_CC})
elseif(ENV{MPI_CC})
set(CMAKE_C_COMPILER ENV{MPI_CC})
set(MPI_CC ${CMAKE_C_COMPILER})
set(ENV{MPI_CC} ${CMAKE_C_COMPILER})
elseif($ENV{MPI_CC})
set(MPI_CC ${CMAKE_C_COMPILER})
set(ENV{MPI_CC} ${CMAKE_C_COMPILER})
else()
message(FATAL_ERROR "GASNet MPI Conduit selected; $MPI_CC not found!")
endif()

if(NOT "$CMAKE_C_COMPILER" STREQUAL "${MPI_CC}")
message(FATAL_ERROR "GASNet MPI: $MPI_CC != $CMAKE_C_COMPILER!")
endif()

execute_process(
COMMAND
bash -c
Expand Down

0 comments on commit 103a7b8

Please sign in to comment.