Skip to content

Commit e754b91

Browse files
authored
Add small sandbox test for OMP offload in a python extension. (#584)
* Add small sandbox test for OMP offload in a python extension. * Update omp target kernels to use is_device_ptr() * Change target offload code to use is_device_ptr
1 parent ee47b33 commit e754b91

File tree

11 files changed

+846
-156
lines changed

11 files changed

+846
-156
lines changed

etc/pyomptarget/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
# GCC 12.1.0 with offload support
3+
CXX := g++-12
4+
CXXFLAGS := -O0 -g -fPIC -pthread -std=c++11 -fcf-protection=none -fno-stack-protector
5+
CXX_OMP_FLAGS := -fopenmp -foffload=nvptx-none='-Wa,-m,sm_80 -misa=sm_80 -fPIC -lm -latomic'
6+
7+
# NVHPC
8+
# CXX = nvc++
9+
# CXXFLAGS = -O0 -g -fPIC -pthread -std=c++11
10+
# CXX_OMP_FLAGS = -mp=gpu -Minfo=mp -gpu=cc86
11+
12+
13+
pybind := ../../src/toast/pybind11
14+
modext := $(shell python3-config --extension-suffix)
15+
pyincl := $(shell python3-config --includes)
16+
17+
18+
pyomptarget$(modext) : module.o
19+
$(CXX) -shared -o pyomptarget$(modext) module.o $(CXX_OMP_FLAGS)
20+
21+
module.o : module.cpp
22+
$(CXX) $(CXXFLAGS) $(CXX_OMP_FLAGS) -I. -I$(pybind)/include $(pyincl) -c -o module.o module.cpp
23+
24+
25+
clean :
26+
rm -f *.so *.o
27+

0 commit comments

Comments
 (0)