forked from hpc4cmb/toast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin new omp target update PR to replace hpc4cmb#603
- Loading branch information
Showing
8 changed files
with
466 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,40 @@ | ||
|
||
# GCC 12.1.0 with offload support | ||
CXX := g++-12 | ||
CXXFLAGS := -O0 -g -fPIC -pthread -std=c++11 -fcf-protection=none -fno-stack-protector | ||
CXX_OMP_FLAGS := -fopenmp -foffload=nvptx-none='-Wa,-m,sm_80 -misa=sm_80 -fPIC -lm -latomic' | ||
#CXX := g++-12 | ||
#CXXFLAGS := -O0 -g -fPIC -pthread -std=c++11 -fcf-protection=none -fno-stack-protector | ||
#CXX_OMP_FLAGS := -fopenmp -foffload=nvptx-none='-Wa,-m,sm_80 -misa=sm_80 -fPIC -lm -latomic' | ||
|
||
# NVHPC | ||
# CXX = nvc++ | ||
# CXXFLAGS = -O0 -g -fPIC -pthread -std=c++11 | ||
# CXX_OMP_FLAGS = -mp=gpu -Minfo=mp -gpu=cc86 | ||
|
||
# AMD LLVM | ||
CXX := amdclang++ | ||
CXXFLAGS := -O3 -g -fPIC -std=c++11 | ||
CXX_OMP_FLAGS := -fPIC -fopenmp -fopenmp-target-debug=3 -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx1030 | ||
CXX_LD_FLAGS := -lomp -lomptarget -lomptarget.rtl.amdgpu | ||
|
||
pybind := ../../src/toast/pybind11 | ||
modext := $(shell python3-config --extension-suffix) | ||
pyincl := $(shell python3-config --includes) | ||
|
||
|
||
all : device_info test pyomptarget$(modext) | ||
|
||
|
||
pyomptarget$(modext) : module.o | ||
$(CXX) -shared -o pyomptarget$(modext) module.o $(CXX_OMP_FLAGS) | ||
$(CXX) -shared $(CXX_OMP_FLAGS) -o pyomptarget$(modext) module.o $(CXX_LD_FLAGS) | ||
|
||
module.o : module.cpp | ||
$(CXX) $(CXXFLAGS) $(CXX_OMP_FLAGS) -I. -I$(pybind)/include $(pyincl) -c -o module.o module.cpp | ||
|
||
device_info : device_info.cpp | ||
$(CXX) $(CXXFLAGS) $(CXX_OMP_FLAGS) -o device_info device_info.cpp $(CXX_LD_FLAGS) | ||
|
||
test : test.cpp | ||
$(CXX) $(CXXFLAGS) $(CXX_OMP_FLAGS) -o test test.cpp $(CXX_LD_FLAGS) | ||
|
||
clean : | ||
rm -f *.so *.o | ||
rm -f *.so *.o device_info test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
#include <omp.h> | ||
//#include "omptarget.h" | ||
#include <iostream> | ||
|
||
int main(int argc, char **argv) { | ||
int ndev = omp_get_num_devices(); | ||
std::cout << "OMP found " << ndev << " available target offload devices" << std::endl; | ||
int target = ndev - 1; | ||
int host = omp_get_initial_device(); | ||
int defdev = omp_get_default_device(); | ||
std::cout << "OMP initial host device = " << host << std::endl; | ||
std::cout << "OMP target device = " << target << std::endl; | ||
std::cout << "OMP default device = " << defdev << std::endl; | ||
return 0; | ||
} | ||
|
Oops, something went wrong.