openacc

Gcc offload compilation options

纵饮孤独 提交于 2020-12-13 03:33:32
问题 I'm trying to build the simplest OpenMP or OpenACC C++ program with GPU offload using gcc-10, CUDA 11 on Ubuntu 18.04 and this CMakeLists.txt file (or OpenMP version): cmake_minimum_required(VERSION 3.18) project(hello VERSION 0.1.0) find_package(OpenACC REQUIRED) add_executable(hello main.cpp) target_compile_options(hello PRIVATE -O3 -fopenacc -foffload=nvptx-none) target_link_libraries (hello OpenACC::OpenACC_CXX) The build fails with: [build] [100%] Linking CXX executable hello [build]

Gcc offload compilation options

女生的网名这么多〃 提交于 2020-12-13 03:31:48
问题 I'm trying to build the simplest OpenMP or OpenACC C++ program with GPU offload using gcc-10, CUDA 11 on Ubuntu 18.04 and this CMakeLists.txt file (or OpenMP version): cmake_minimum_required(VERSION 3.18) project(hello VERSION 0.1.0) find_package(OpenACC REQUIRED) add_executable(hello main.cpp) target_compile_options(hello PRIVATE -O3 -fopenacc -foffload=nvptx-none) target_link_libraries (hello OpenACC::OpenACC_CXX) The build fails with: [build] [100%] Linking CXX executable hello [build]

Using F2Py with OpenACC gives import error in Python

自闭症网瘾萝莉.ら 提交于 2020-05-15 11:23:01
问题 I am writing a simple test code to see how I could wrap a fortran code containing openacc regions and call from python. Here's the code. module test use iso_c_binding, only: sp => C_FLOAT, dp => C_DOUBLE, i8 => C_INT implicit none contains subroutine add (a, b, n, c) integer(kind=i8), intent(in) :: n real(kind=dp), intent(in) :: a(n) real(kind=dp), intent(in) :: b(n) real(kind=dp), intent(out) :: c(n) integer(kind=i8) :: i !$acc enter data create(a, b, c) do i = 1, n c(i) = a(i) + b(i) end do

Using F2Py with OpenACC gives import error in Python

我只是一个虾纸丫 提交于 2020-05-15 11:21:10
问题 I am writing a simple test code to see how I could wrap a fortran code containing openacc regions and call from python. Here's the code. module test use iso_c_binding, only: sp => C_FLOAT, dp => C_DOUBLE, i8 => C_INT implicit none contains subroutine add (a, b, n, c) integer(kind=i8), intent(in) :: n real(kind=dp), intent(in) :: a(n) real(kind=dp), intent(in) :: b(n) real(kind=dp), intent(out) :: c(n) integer(kind=i8) :: i !$acc enter data create(a, b, c) do i = 1, n c(i) = a(i) + b(i) end do

Compiling c++ OpenACC parallel CPU code using GCC (G++)

眉间皱痕 提交于 2020-04-18 05:36:14
问题 When trying to compile OpenACC code with GCC-9.3.0 (g++) configured with --enable-languages=c,c++,lto --disable-multilib the following code does not use multiple cores, whereas if the same code is compiled with the pgc++ compiler it does use multiple cores. g++ compilation: g++ -lgomp -Ofast -o jsolve -fopenacc jsolvec.cpp pgc++ compilation: pgc++ -o jsolvec.exe jsolvec.cpp -fast -Minfo=opt -ta=multicore Code from OpenACC Tutorial1/solver https://github.com/OpenACCuserGroup/openacc-users

use memcpy for device arrays in openacc

ε祈祈猫儿з 提交于 2020-01-07 04:49:06
问题 Please, help. 1) I need to use memcpy for moving the arrays allocated on the gpu. i can not use std::memcpy because it "has no acc routine" (compiler output). My code is const int GL=100000; Particle particles[GL]; int cp01[2][GL]; #pragma acc declare create(particles,cp01) ... i read that cudaMemcpy can be used with openacc. In function_device() (not able to fill the array allocated on the gpu) i call from the host #pragma acc data copy(cp) { cudaMemcpy(&particles[cp01[0][0]],&particles[cp01

openACC passing a list of struct

杀马特。学长 韩版系。学妹 提交于 2020-01-05 04:27:09
问题 I have a C program to find whether 2 sets of polygons are overlapped. User input 2 sets of polygon (each set of data has several thousands polygons) and the program see which polygon in set1 overlap with which polygon in set2 I have 2 struct like these: struct gpc_vertex /* Polygon vertex */ { double x; double y; }; struct gpc_vertex_list /* Polygon contour */ { int pid; // polygon id int num_vertices; double *mbr; // minimum bounding rectangle of the polygon, so always 4 elements }; I have

linking pgi compiled library with gcc linker

ε祈祈猫儿з 提交于 2020-01-03 05:50:06
问题 I would like to know how to link a pgc++ compiled code (blabla.a) with a main code compiled with c++ or g++ GNU compiler. For the moment linking with default gnu c++ linker gives errors like: undefined reference to `__pgio_initu' 回答1: As the previous person already pointed out, PGI supports G++ name mangling when using the pgc++ command. Judging from this output, I'm guessing that you're linking with g++ rather than pgc++. I've had the most success when using pgc++ as the linker so that it

Difference between kernels construct and parallel construct

為{幸葍}努か 提交于 2019-12-31 10:41:13
问题 I study a lot of articles and the manual of OpenACC but still i don't understand the main difference of these two constructs. 回答1: kernels directive is the more general case and probably one that you might think of, if you've written GPU (e.g. CUDA) kernels before. kernels simply directs the compiler to work on a piece of code, and produce an arbitrary number of "kernels", of arbitrary "dimensions", to be executed in sequence, to parallelize/offload a particular section of code to the

Difference between kernels construct and parallel construct

冷暖自知 提交于 2019-12-31 10:40:24
问题 I study a lot of articles and the manual of OpenACC but still i don't understand the main difference of these two constructs. 回答1: kernels directive is the more general case and probably one that you might think of, if you've written GPU (e.g. CUDA) kernels before. kernels simply directs the compiler to work on a piece of code, and produce an arbitrary number of "kernels", of arbitrary "dimensions", to be executed in sequence, to parallelize/offload a particular section of code to the