cfcf04d502
HIP supports emitting two types of static libraries. One type will export host functions and is compatible with host linkers. The second type exports device functions, but is generated with ar manually. Also, add a README with steps on how to run these samples with Makefile or CMake. Change-Id: I1be15c2884583b370092bc8e4bf04f726f8f5a27
32 lines
636 B
Makefile
32 lines
636 B
Makefile
HIP_PATH?= $(wildcard /opt/rocm/hip)
|
|
ifeq (,$(HIP_PATH))
|
|
HIP_PATH=../../..
|
|
endif
|
|
|
|
HIPCC=$(HIP_PATH)/bin/hipcc
|
|
|
|
.PHONY: test
|
|
|
|
all: $(RDC_EXE) test
|
|
|
|
STATIC_LIB_SRC=hipDevice.cpp
|
|
STATIC_LIB=./libHipDevice.a
|
|
STATIC_MAIN_SRC=hipMain2.cpp
|
|
RDC_EXE=./test_device_static.out
|
|
|
|
$(STATIC_LIB):
|
|
$(HIPCC) $(STATIC_LIB_SRC) -c -fgpu-rdc -fPIC -o hipDevice.o
|
|
ar rcsD $@ hipDevice.o
|
|
|
|
# Compiles hipMain2 with hipcc and links with libHipDevice.a which contains device function.
|
|
$(RDC_EXE): $(STATIC_LIB)
|
|
$(HIPCC) $(STATIC_LIB) $(STATIC_MAIN_SRC) -fgpu-rdc -o $@
|
|
|
|
test: $(RDC_EXE)
|
|
$(RDC_EXE)
|
|
|
|
clean:
|
|
rm -f $(RDC_EXE)
|
|
rm -f $(STATIC_LIB)
|
|
rm -f *.o
|