LLNL / blt

A streamlined CMake build system foundation for developing HPC software
BSD 3-Clause "New" or "Revised" License
260 stars 60 forks source link

-pthread shows up in BLT_CUDA_LIBRARIES and BLT_CUDA_RUNTIME_LIBRARIES #344

Open bmhan12 opened 4 years ago

bmhan12 commented 4 years ago

When reconfiguring a GEOSX build with CUDA using older versions of CMake (3.9 and 3.12 was tested), BLT_CUDA_LIBRARIES and BLT_CUDA_RUNTIME_LIBRARIES had their -lpthread flag change to -pthread.

white238 commented 4 years ago
# Removes -pthread from BLT CUDA libraries lists
if (ENABLE_CUDA)
  set(_cuda_libraries)
  foreach(_lib ${BLT_CUDA_LIBRARIES})
    if ("${_lib}" STREQUAL "-pthread")
      list(APPEND _cuda_libraries "-lpthread")
    else()
      list(APPEND _cuda_libraries "${_lib}")
    endif()
  endforeach()

  set(BLT_CUDA_LIBRARIES "${_cuda_libraries}" CACHE STRING "" FORCE)
  set(BLT_CUDA_RUNTIME_LIBRARIES "${_cuda_libraries}" CACHE STRING "" FORCE)
endif()
white238 commented 4 years ago

The above code fixed it in GEOSX. This is also handled (maybe incorrectly) in SetupMPI.cmake by simply removing the -pthread argument from the link command.