Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

latest ifort but not latest openmp, perhaps?

high_end_c_
Beginner
389 Views

Hi, I thought that ifort v17 would support OMP 4/4.5 including offloading to GPU. I can see this is heterogeneous for the binaries (Intel CPU & NVIDIA GPU) but is there no way forward on this? (I thought gfortran supported offloading to GPUs but the version I have installs fails the "target" directive

Yours, Michael, High End Compute Ltd

 

Here's my example:

michaelbane@tGPUmachine:~/HEC/FORTRAN$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.2.174 Build 20170213
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

ifort: NOTE: The evaluation period for this product ends on 20-apr-2017 UTC.
michaelbane@tGPUmachine:~/HEC/FORTRAN$ cat vecadd_openmp.f90
program vecadd
  implicit none
  double precision, allocatable:: x(:), y(:), z(:)
  integer, parameter:: num=198760010 !1987612345
  double precision:: trueAns, testResult
  integer:: i, errFlag

! alloc vars
  allocate(x(1:num), y(1:num), z(1:num), stat=errFlag)
  if (errFlag > 0) stop 'error during allocation'

  write(*,'("Vec addition for dimensional ",(i))') num
  do i=1, num
     x(i) = i+1.0
     y(i) = (i+1)*11.0
  end do

! call kernel
  call vecaddkernel(x, y, z, num)


! check answer
  trueAns = 12.0d0*(0.5d0*dfloat(num+1)*dfloat(num+2)-1.0d0)  ! may lose fl pt accuracy
  call getSerialAnswer(testResult, num)
  write(*,'("kernel sum: ",e12.5," serial sum: ",e12.5," analytic sum: ",e12.5)') &
       & sum(z(1:num)), testResult, trueAns


contains
  subroutine vecaddkernel(in1, in2, out, dimen)
    implicit none
    integer:: dimen, i
    double precision in1(dimen), in2(dimen), out(dimen)
!$omp target device(0)
!$omp parallel do
    do i=1, dimen
       out(i) = in1(i) + in2(i)                               ! these summed in a good order
    end do
!$omp end target
    return
    end subroutine vecaddkernel

    subroutine getSerialAnswer(result, dimen)
      implicit none
      integer:: dimen
      double precision:: res(1:dimen)
      double precision:: result
      result=0.0
      do i=1, dimen
         result = result + (i+1.0) + ((i+1)*11.0)             ! these summed in a good order
      end do
      return
    end subroutine getSerialAnswer
end program vecadd

michaelbane@tGPUmachine:~/HEC/FORTRAN$ ifort -qopenmp vecadd_openmp.f90
ifort: warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.
x86_64-k1om-linux-ld: No such file or directory
 

0 Kudos
1 Reply
TimP
Honored Contributor III
389 Views

Ifort supports openmp offload only for Mic knc processor, requiring the optional mpss installation.

Gfortran supports offload in host emulation

0 Kudos
Reply