-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (49 loc) · 2.15 KB
/
Makefile
File metadata and controls
63 lines (49 loc) · 2.15 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(mkfile_dir)../Makefile.defs
HPGMG_ARCH := $(if $(PETSC_ARCH),$(PETSC_ARCH),build)
host_debug_flag ?=
AOMP_GPU ?= $(INSTALLED_GPU)
AOMP_GPUTARGET = amdgcn-amd-amdhsa
ifeq (sm_,$(findstring sm_,$(AOMP_GPU)))
AOMP_GPUTARGET = nvptx64-nvidia-cuda
endif
AOMP_CPUTARGET ?= x86_64-pc-linux-gnu
ifeq (nvptx,$(findstring nvptx,$(AOMP_GPUTARGET)))
CUDA ?= /usr/local/cuda
CUDA_LIBS=-L$(CUDA)/lib64 -lcuda -lcudart -lelf -lffi
endif
DEBUG_LEVEL ?= 0
ifeq ($(DEBUG_LEVEL),0)
SETDEBUGLIB =
SETDEBUGRUNENV =
else
# if DEBUG_LEVEL != 0, build with the debug libraries which are slow.
SETDEBUGLIB = LIBRARY_PATH=$(AOMP)/lib-debug
# Once you build with debug libs, you have different levels of debug
# by setting these environment variables.
# LIBOMPTARGET_DEBUG: Host device runtime debug messages
SETDEBUGRUNENV = LIBOMPTARGET_DEBUG=1
# LIBOMPTARGET_DEVICE_RTL_DEBUG: Device runtime debug messages.
#SETDEBUGRUNENV = LIBOMPTARGET_DEVICE_RTL_DEBUG=-1
# ATMI_DEBUG: Print ATMI debug messages
#SETDEBUGRUNENV = ATMI_DEBUG=1
endif
# NOTE: You do NOT need debug libs to turn kernel tracing on.
# Set LIBOMPTARGET_KERNEL_TRACE anytime to get kernel launch trace.
# Uncomment next line to activate kernel launch trace in this makefile.
#SETDEBUGRUNENV += LIBOMPTARGET_KERNEL_TRACE=1
all: build
hpgmgconf.pyc:
@echo "Running config for directory $(HPGMG_ARCH). "
PATH=/usr/bin:$(PATH) ./configure --arch=$(HPGMG_ARCH) --no-fe --no-fv-mpi --CC=$(AOMP)/bin/clang --CFLAGS="-O3 $(host_debug_flags) -target $(AOMP_CPUTARGET) -fopenmp -fopenmp-targets=$(AOMP_GPUTARGET) -Xopenmp-target=$(AOMP_GPUTARGET) -march=$(AOMP_GPU)" --LDFLAGS="-lm -fopenmp -fopenmp-targets=$(AOMP_GPUTARGET) -target $(AOMP_CPUTARGET)" --LDLIBS="$(CUDA_LIBS)"
build: hpgmgconf.pyc
$(SETDEBUGLIB) $(MAKE) -C $(HPGMG_ARCH)
@echo "Build complete in $(HPGMG_ARCH). Use make run to test"
run:
$(SETDEBUGRUNENV) ./$(HPGMG_ARCH)/bin/hpgmg-fv 4 128
#./$(HPGMG_ARCH)/bin/hpgmg-fv sample -local 50,10000 -repeat 3 -op_type poisson2
test : all
$(SETDEBUGLIB) $(MAKE) -C $(HPGMG_ARCH) test
clean :
rm -rf build ; rm -f hpgmgconf.pyc
.PHONY: all test clean