Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Respect CMAKE_EXE_LINKER_FLAGS/CMAKE_SHARED_LINKER_FLAGS flags set via CLI #830

Draft
pramodk wants to merge 2 commits into master
base: master
Choose a base branch
Loading
from pramodk/omp-simd

Conversation

@pramodk
Copy link
Collaborator

@pramodk pramodk commented Jun 22, 2022

Description

In the case of Clang, we were always overriding the above-mentioned flags
and hence cmake args were ignored (resulting in link errors)

How to test this?

On BB5 with Clang compiler

module load unstable gcc llvm hpe-mpi cmake python-dev flex bison
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCORENRN_ENABLE_GPU=OFF -DCORENRN_ENABLE_NMODL=OFF -DCORENRN_ENABLE_MPI=ON -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_TESTS=OFF '-DCMAKE_EXE_LINKER_FLAGS=-L/gpfs/bbp.cscs.ch/home/kumbhar/spack_install/software/install_gcc-11.2.0-skylake/intel-oneapi-mkl-202140-gbepe3/compiler/2021.4.0/linux/compiler/lib/intel64_lin -lsvml -lintlc -Wl,-rpath,/gpfs/bbp.cscs.ch/home/kumbhar/spack_install/software/install_gcc-11.2.0-skylake/intel-oneapi-mkl-202140-gbepe3/compiler/2021.4.0/linux/compiler/lib/intel64_lin' '-DCMAKE_CXX_FLAGS=-Rpass=loop-vectorize -Rpass-missed=loop-vectorize -Rpass-analysis=loop-vectorize -fsave-optimization-record -O3 -march=skylake-avx512 -mtune=skylake -ffast-math -fopenmp-simd -fveclib=SVML'
make -j8

Test System

BB5

...a CLI
In case of Clang, we were always overriding the above mentioned flags
and hence cmake args were ignored (resuliting in link errors)
@pramodk pramodk requested review from alkino and olupton June 22, 2022 08:01
# linked. Symbols needed in shared objects are already linked when building that library.
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed${CMAKE_EXE_LINKER_FLAGS}")
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use https://cmake.org/cmake/help/latest/command/string.html#append to avoid repeating the variable name, I think, but no big deal.

$(CXX_LINK_EXE_CMD) -o $(SPECIAL_EXE) $(CORENRN_SHARE_CORENRN_DIR)/coreneuron.cpp \
-I$(CORENRN_INC_DIR) $(INCFLAGS) \
-L$(OUTPUT_DIR) -l$(COREMECH_LIB_NAME) $(CORENRNLIB_FLAGS) $(LDFLAGS) \
-L$(OUTPUT_DIR) -l$(COREMECH_LIB_NAME) $(CORENRNLIB_FLAGS) $(LDFLAGS) $(CXX_LINK_EXE_FLAGS) \
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can see the changes to this file just re-order some flags. Is that important?

Copy link
Contributor

Choose a reason for hiding this comment

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

I now see the commit message about it needing to be later. Can you add a comment/documentation about that issue/detail?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, I should have put this PR in draft - haven't thoroughly checked how/why -Wl,--as-needed causes this but I remember this flag was needed in case wheel building. I will check this bit later and get back here.

@pramodk pramodk marked this pull request as draft September 19, 2022 19:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@alkino alkino Awaiting requested review from alkino

1 more reviewer

@olupton olupton olupton approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /