This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: OpenACC-Library-Interoperability
- From: Vikram Singh <vikramsingh001 at gmail dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: Salvatore Filippone <filippone dot salvatore at gmail dot com>, Vladimír Fuka <vladimir dot fuka at gmail dot com>, James Norris <jnorris at codesourcery dot com>, Chung-Lin Tang <cltang at codesourcery dot com>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Mon, 29 Aug 2016 16:58:35 +0300
- Subject: Re: OpenACC-Library-Interoperability
- Authentication-results: sourceware.org; auth=none
- References: <CAD0gq3XehzKyOqvqWfmSErNiy8CKkHqNvqAg5nU5eCyV5gQ4RA@mail.gmail.com> <8737qn5rd4.fsf@kepler.schwinge.homeip.net> <CAD0gq3XgHLLWfY8BJWCc2vPC6S4E2tHBvBfdok0yK5Gs4K5Qzw@mail.gmail.com> <8760vj45bi.fsf@hertz.schwinge.homeip.net> <CAKe2itfWOXb11iRpVtJXsU9Eh-3RpdK4dt_WX+WRO6bLvgd-NQ@mail.gmail.com> <CANSzZf4vnc23kHpSGQ4mW8RmuAYeytZu8dYvPQ3xi_v9V9Q7iQ@mail.gmail.com> <2b4f59d5-be38-2814-27bb-73aa7ffb4b8f@codesourcery.com> <878u0o6wwj.fsf@kepler.schwinge.homeip.net> <CAD0gq3VX0x6qCkMWLJBqK=9WRYk0O_38yCctwaQRcmqdWU0jiQ@mail.gmail.com> <87inyjuw6b.fsf@kepler.schwinge.homeip.net> <CAD0gq3VoRWCiXRkgi-bnGLBfSjR-bFc0Mzp19LRr+yWP4MrYLg@mail.gmail.com> <CAD0gq3WmRfe7g-F-=imZMZg9zNE=sJ8xTcveb-H9F7_92wSjVA@mail.gmail.com>
Hi,
I tried the installation on yet another machine. It seems that the
installation goes along on Ubuntu, but for some reason not on Red Hat.
So I would request someone to please look at that.
Anyway, I installed gcc6.2 using the same steps. I believe host_data
has been implemented on gcc 6.2. So I tried the following code.
program example_dgemm
use iso_c_binding
implicit none
integer, parameter :: N = 8
real(c_double) :: A(N,N), B(N, N), C(N, N)
integer :: i, j
!$acc enter data create(A, B)
!$acc parallel present(A)
do i = 1, N
do j = 1, N
A(i, j) = i + j
end do
end do
!$acc end parallel
!$acc parallel present(B)
do i = 1, N
do j = 1, N
B(i, j) = j
end do
end do
!$acc end parallel
! Do DGEMM on the GPU
!$acc host_data use_device(A, B, C)
call cublas_DGEMM('N', 'N', N, N, N, &
1.0_c_double, A, N, B, N, 0.0_c_double, C, N)
!$acc end host_data
end program example_dgemm
First, from the previous code, I had to change A, B, C from
allocatable to fixed size. Seems, gfortran host_data does not allow
allocatable arrays.
This code atleast compiles. Unfortunately on running it, I get the error,
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x7f046e5bacaf in ???
#1 0x408b1d in cublas_dgemm_
at fortran.c:1461
#2 0x40477d in example_dgemm
at test.f90:37
#3 0x403e9c in main
at test.f90:42
Segmentation fault (core dumped)
It seems to me the data type is not being correctly translated to what
DGEMM requires.
Regards,
Vikram