-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.inc
63 lines (56 loc) · 1.99 KB
/
Makefile.inc
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ifeq ("","$(wildcard $(EXTSHOME)/dbcsr/src)")
$(error "No DBCSR submodule available, please run 'git submodule update --init --recursive'")
endif
LIBS := -L$(LIBEXTSDIR)/dbcsr -ldbcsr $(LIBS)
EXTSDEPS_LIB = $(LIBEXTSDIR)/dbcsr/libdbcsr$(ARCHIVE_EXT)
EXTSDEPS_MOD = $(OBJEXTSDIR)/dbcsr/dbcsr_api.mod $(OBJEXTSDIR)/dbcsr/dbcsr_tensor_api.mod
$(EXTSDEPS_MOD) : ; # override builtin .mod rule to prevent circular dependency
# Set Acceleration flags if glue code is supposed to be accelerated
ifneq (,$(findstring __DBCSR_ACC,$(OFFLOAD_FLAGS) $(FCFLAGS)))
# By default, we use CUDA if OFFLOAD_TARGET is not specified
ifeq (,$(OFFLOAD_TARGET))
DBCSR_USE_ACCEL = cuda
else
DBCSR_USE_ACCEL = $(OFFLOAD_TARGET)
endif
ifeq (cuda,$(DBCSR_USE_ACCEL))
DBCSR_ACC := $(OFFLOAD_CC)
DBCSR_ACCFLAGS := $(OFFLOAD_FLAGS) -Xcompiler='-Wno-error'
else ifeq (hip,$(DBCSR_USE_ACCEL))
DBCSR_ACC := $(CXX)
DBCSR_ACCFLAGS := $(CXXFLAGS) -Wno-error=unused-parameter
else ifeq (opencl,$(DBCSR_USE_ACCEL))
DBCSR_ACC := $(CC)
DBCSR_ACCFLAGS := $(CFLAGS)
else
$(error "Invalid OFFLOAD_TARGET=$(OFFLOAD_TARGET)")
endif
endif
extversions: dbcsrversion
extclean: dbcsrclean
@echo "Clean EXT"
dbcsr:
+$(MAKE) -C $(EXTSHOME)/$@ -f $(EXTSHOME)/build_$@/Makefile \
ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
LIBDIR=$(LIBEXTSDIR)/$@ \
OBJDIR=$(OBJEXTSDIR)/$@ \
USE_ACCEL="$(DBCSR_USE_ACCEL)" \
ACC="$(DBCSR_ACC)" \
ACCFLAGS="$(strip $(DBCSR_ACCFLAGS))"
dbcsrversion:
@$(MAKE) -C $(EXTSHOME)/dbcsr -f $(EXTSHOME)/build_dbcsr/Makefile \
ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
USE_ACCEL="$(DBCSR_USE_ACCEL)" \
ACC="$(DBCSR_ACC)" \
ACCFLAGS="$(strip $(DBCSR_ACCFLAGS))" \
version
dbcsrclean:
@echo "Clean DBCSR"
@$(MAKE) -C $(EXTSHOME)/dbcsr -f $(EXTSHOME)/build_dbcsr/Makefile \
ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
LIBDIR=$(LIBEXTSDIR)/$@ \
OBJDIR=$(OBJEXTSDIR)/$@ \
USE_ACCEL="$(DBCSR_USE_ACCEL)" \
ACC="$(DBCSR_ACC)" \
ACCFLAGS="$(strip $(DBCSR_ACCFLAGS))" \
clean