[ET Trac] #2553: Cactus' link command uses CPPFLAGS and CXXFLAGS
Roland Haas
trac-noreply at einsteintoolkit.org
Wed Aug 11 17:13:14 CDT 2021
#2553: Cactus' link command uses CPPFLAGS and CXXFLAGS
Reporter: Roland Haas
Status: open
Milestone:
Version: development version
Type: bug
Priority: minor
Component: Cactus
Comment (by Roland Haas):
Well making LD be nvcc gives me extra trouble when compiling ExternalLibraries \(same sort of issues that come from having Cactus LIBS mean something different then autoconf’s LIBS\).
Instead I peeked at Formaline and wrote a short ExternallLibraries/CUDA thorn that adapts Cactus' link step based on the documentation by NVIDIA. The thorn is here: [https://github.com/rhaas80/ExternalLibraries-CUDA.git](https://github.com/rhaas80/ExternalLibraries-CUDA.git) and the trick is to collect all CUDA code in a new library using nvcc \(just as NVIDIA shows\):
```
CACTUSLIBLINKLINE += -l$(CCTK_LIBNAME_PREFIX)CUDA-gpucode
CUDA-LIB = $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)CUDA-gpucode$(LIBNAME_SUFFIX)
$(EXEDIR)$(DIRSEP)$(EXE): $(CUDA-LIB)
# TODO: make this depend on only the thorns that REQUIRE CUDA
# TODO: check if depending on LINKLIST would be enough
$(CUDA-LIB): $(CONFIG)/make.thornlist $(CONFIG)/cctki_version.h $(patsubst %,$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX),$(notdir $(THORNS) $(CACTUSLIBS))) $(CCTK_LIBDIR)/LINKLIST
$(CUCC) $(patsubst %,$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)%$(LIBNAME_SUFFIX),$(ALLCACTUSLIBS)) -dlink -o $@
if test "x$(USE_RANLIB)" = "xyes"; then $(RANLIB) $(RANLIBFLAGS) $@; fi
@echo $(DIVIDER)
```
which lets me compile this thornlist:
```
ExternalLibraries/CUDA
```
and run this parfile:
```
ActiveThorns = CUDA
CUDA::test = yes
```
I think this should work, though I have not tested it on a system where `-filelist` is actually supported \(given that Linux does not, I assume nothing does anymore\), in which case maybe there are no libthornFOO.a files but only the raw object files.
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2553/cactus-link-command-uses-cppflags-and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/trac/attachments/20210811/b0fea3a8/attachment.html
More information about the Trac
mailing list