Repository navigation
Expand file tree
/
Copy pathMakefile.am
More file actions
46 lines (39 loc) · 2.2 KB
/
Copy pathMakefile.am
File metadata and controls
46 lines (39 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# these are custom variables, but are named similar to the corresponding automake
# variables, as they similarly contain user-provided resp. configured flags to the compiler
# CUDA 13's libcu++ headers require C++17 or later.
AM_CUDA_CXXFLAGS = --std=c++17
AM_CUDA_LIBS = -lcudart
lib_LTLIBRARIES = libcudaenum.la
libcudaenum_la_SOURCES = src/cuda_wrapper.cu
libcudaenum_la_LIBADD = $(CUDA_LDFLAGS) $(AM_CUDA_LIBS)
CUDAENUM_HEADER_DEPS = $(wildcard $(srcdir)/src/*.h $(srcdir)/src/*.cuh)
src/cuda_wrapper.lo: $(CUDAENUM_HEADER_DEPS)
bin_PROGRAMS = cudaenum_test
cudaenum_test_SOURCES = src/test.cpp src/testdata.cpp
cudaenum_test_LDADD = libcudaenum.la
check_PROGRAMS = runtime_config_test conditioned_partition_test
runtime_config_test_SOURCES = src/runtime_config_test.cpp
runtime_config_test_LDADD = libcudaenum.la
conditioned_partition_test_SOURCES = src/conditioned_partition_test.cu
conditioned_partition_test_LDADD = libcudaenum.la $(CUDA_LDFLAGS) $(AM_CUDA_LIBS)
conditioned_partition_test_LINK = $(CXXLINK)
TESTS = runtime_config_test conditioned_partition_test tests/queue_wrap.sh
TESTS_ENVIRONMENT = top_builddir='$(abs_top_builddir)'
# libtools does not support nvcc. I have thought of the following workarounds
# - do not use libtools
# - use libtools and tell it to use nvcc as a C++ compiler
# - use a custom libtool-like script
#
# The first idea seems to be not recommended, it might void some portability advantages
# and it would also be inconsistent with fplll.
# The second approach has an issue with PIC code generation, as nvcc does not accept the
# PIC flags libtools might pass to it, but without those PIC flags, the libtool descriptor
# (the *.lo file) is unusable.
# Therefore, we settle for the last option, following a guide that can be found at
# www.clusterchimps.org/autotools.php. This is mainly what the python file `cudalt.py`
# is used for. This is triggered by the following rules:
LINK = $(LIBTOOL) --mode=link $(CC) -o $@
.cu.o:
$(NVCC) $(CUDA_CXXFLAGS) $(AM_CUDA_CXXFLAGS) -o $@ -c $<
.cu.lo:
$(PYTHON) $(top_srcdir)/cudalt.py "$(LIBTOOL)" $@ "$(NVCC)" $(CUDA_CXXFLAGS) $(AM_CUDA_CXXFLAGS) --compiler-options="$(CXXFLAGS) $(AM_CXXFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(AM_CPPFLAGS)" -c $<