This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenACC-Library-Interoperability


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]