Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Avoid setting additional linker flags at global scope
Browse files Browse the repository at this point in the history
 * Setting CMAKE_EXE_LINKER_FLAGS was used also for NMODL
   when NMODL is built from submodule
 * In case of LLVM OpenMP offload, if binary is being created
   from the object that is not compiled with OpenMP flags,
   it causes link error:

   echo "int main() { return 0; } " > foo.cpp
   clang++ -c foo.cpp                                           # adding openmp flags here doesn't cause below error
   clang++ foo.o -o foo -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda

     nvlink fatal   : Could not open input file '/tmp/foo-0b9a1a.cubin'
     clang-12: error: nvlink command failed with exit code 1 (use -v to see invocation)
  • Loading branch information
pramodk committed Jan 3, 2022
1 parent 439c560 commit 6ff530c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion CMake/OpenAccHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ if(CORENRN_ENABLE_GPU)
endif()
# avoid PGI adding standard compliant "-A" flags
# set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14)
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${NVHPC_ACC_COMP_FLAGS}")
# Use `-Mautoinline` option to compile .cpp files generated from .mod files only. This is
# especially needed when we compile with -O0 or -O1 optimisation level where we get link errors.
# Use of `-Mautoinline` ensure that the necessary functions like `net_receive_kernel` are inlined
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ endif()
# =============================================================================
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IGNORE_UNKNOWN_PRAGMA_FLAGS}")

# Set coreneuron specific linker flag after NMODL submodule is added
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${NVHPC_ACC_COMP_FLAGS}")

# =============================================================================
# Add main directories
# =============================================================================
Expand Down

0 comments on commit 6ff530c

Please sign in to comment.