Merge pull request #66 from ams-cs/master

Add GNU OpenACC support for AMD GCN
This commit is contained in:
Tom Deakin 2020-05-22 13:00:15 +01:00 committed by GitHub
commit 272c73a622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -10,8 +10,8 @@
template <class T> template <class T>
ACCStream<T>::ACCStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int device) ACCStream<T>::ACCStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int device)
{ {
acc_device_t device_type = acc_get_device_type();
acc_set_device_num(device, acc_device_nvidia); acc_set_device_num(device, device_type);
array_size = ARRAY_SIZE; array_size = ARRAY_SIZE;
@ -139,7 +139,8 @@ T ACCStream<T>::dot()
void listDevices(void) void listDevices(void)
{ {
// Get number of devices // Get number of devices
int count = acc_get_num_devices(acc_device_nvidia); acc_device_t device_type = acc_get_device_type();
int count = acc_get_num_devices(device_type);
// Print device list // Print device list
if (count == 0) if (count == 0)

View File

@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
### Added ### Added
- Compiler options for OpenMP GNU offloading to NVIDIA and AMD. - Compiler options for OpenMP and OpenACC GNU offloading to NVIDIA and AMD.
### Changed ### Changed
- Use cl::sycl::id parameters instead of cl::sycl::item. - Use cl::sycl::id parameters instead of cl::sycl::item.

View File

@ -3,7 +3,7 @@ ifndef COMPILER
define compiler_help define compiler_help
Set COMPILER to ensure correct flags are set. Set COMPILER to ensure correct flags are set.
Available compilers are: Available compilers are:
PGI CRAY PGI CRAY GNU
endef endef
$(info $(compiler_help)) $(info $(compiler_help))
endif endif
@ -11,6 +11,7 @@ endif
COMPILER_ = $(CXX) COMPILER_ = $(CXX)
COMPILER_PGI = pgc++ COMPILER_PGI = pgc++
COMPILER_CRAY = CC COMPILER_CRAY = CC
COMPILER_GNU = g++
FLAGS_ = -O3 -std=c++11 FLAGS_ = -O3 -std=c++11
@ -48,6 +49,7 @@ FLAGS_PGI += $(TARGET_FLAGS_$(TARGET))
endif endif
FLAGS_CRAY = -hstd=c++11 FLAGS_CRAY = -hstd=c++11
FLAGS_GNU = -O3 -std=c++11 -Drestrict=__restrict -fopenacc
CXXFLAGS = $(FLAGS_$(COMPILER)) CXXFLAGS = $(FLAGS_$(COMPILER))
acc-stream: main.cpp ACCStream.cpp acc-stream: main.cpp ACCStream.cpp