Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Pass GPU_CFLAGS to CUDA linker #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BCSharp
Copy link

@BCSharp BCSharp commented Nov 23, 2021

Currently GPU_CFLAGS (containing --gpu-code and --gpu-architecture) are being passed to nvcc during compilation, but not when producing the shared object (.so) library. As a result, nvcc's defaults are being used, which may or may not match what the object (.o) files may contain, depending on the CUDA version used. In case of a mismatch, warnings are generated.

A safe way to avoid the mismatch is to always link with the same GPU_CPLAGS as used during compilation.

Example warnings on CUDA-11.2 when GPU_ARCHS:=sm_61 and GPU_PTX_ARCH:=compute_61:

nvcc -Xcompiler "-fPIC" --shared --output-file release/libcuda-crypt.so release/crypt-dlink.o release/verify.o release/poh_verify.o release/gpu_ctx.o release/sign.o release/seed.o release/keypair.o
nvlink warning : SM Arch ('sm_52') not found in 'release/verify.o'
nvlink warning : SM Arch ('sm_52') not found in 'release/poh_verify.o'
nvlink warning : SM Arch ('sm_52') not found in 'release/gpu_ctx.o'
nvlink warning : SM Arch ('sm_52') not found in 'release/sign.o'
nvlink warning : SM Arch ('sm_52') not found in 'release/seed.o'
nvlink warning : SM Arch ('sm_52') not found in 'release/keypair.o'

This PR adds $(GPU_CFLAGS) to nvcc parameters used in the linking phase.

@ryoqun ryoqun requested a review from sakridge November 26, 2021 13:13
@ryoqun
Copy link

ryoqun commented Nov 26, 2021

@sakridge could you review this? this looks nice improvement to the build system?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants