Emulation mode -Error 5 cannot open file 'libcudadevice.lib

Hi,

I’m using the PGI CUDA Fortran, with Visual studio 2008 on a windows 7 x64 platform, and I have a problem with emulation mode. When I compile with -Mcuda=emu, I get the following error :

LINK : fatal error LNK1104: cannot open file ‘libcudadevice.lib’

Since I cannot link this library file to my application (can’t find it), what should I do to get emulation mode working? Also, is there any debug program related to the CUDA Fortran?

Thank you

Hi ljubab,

This is a known issue where the library is missing from the PVF packages. In the 13.0 release (due out soon) will have this fixed. The other option is to download and install the PGI Accelerator Workstation for Windows (http://www.pgroup.com/support/download_pgi2012.php?view=current) which does include this library. Once installed, PVF will be able to find the library.

Best Regards,
Mat

Hi Mat,

Thank you for your reply. I have installed PGI Workstation as you suggested, but when I launch the kernel, I get following error :

Error 5: Argument missing for formal argument threadidx

Do you have an idea what seems to be a problem.

Thank you.

Hi ljubab,

I’ve never seen this error before, so don’t know. My best guess is that there is something wrong with you launch configuration, but am not sure. Can you post or send to PGI Customer Service (trs@pgroup.com) an example code which reproduce the problem?

  • Mat

Hi Mat,

Thank you for replay. My code is :

MODULE EQFORCCOLL
USE CUDAFOR

REAL,DEVICE,ALLOCATABLE :: ZB_D(:,:),G11_D(:,:),G22_D(:,:),G12_D(:,:),JA_D(:,:),&
DJAKSI_D(:,:),DJAETA_D(:,:),DXKSI_D(:,:),DXETA_D(:,:),DYKSI_D(:,:),DYETA_D(:,:),&
G22JAKSI_D(:,:,:),G22JAETA_D(:,:),G11JAKSI_D(:,:),G11JAETA_D(:,:,:),&
DXKSIKSI_D(:,:),DYKSIKSI_D(:,:),DXETAKSI_D(:,:),DYETAKSI_D(:,:),DXETAETA_D(:,:),DYETAETA_D(:,:)



CONTAINS
ATTRIBUTES(GLOBAL) SUBROUTINE EQUIL_FORCE_S_COLLIDE(F,U,H,UKAR,EX,EY,&
VIS,DT,G,MKH,KHZM,JLL,KKV,&
MT,MINV,TSTEP,XDIM,YDIM,TSX,TSY,&
SR2,SR3,SR5,SR7)

IMPLICIT NONE

INTEGER,PARAMETER :: E(0:8,2) = RESHAPE([0, 1, 1, 0,-1,-1,-1, 0, 1, 0, 0, 1, 1, 1, 0,-1,-1,-1],[9,2])
INTEGER :: I, J, K, K1,P, X, Y, ID, RDKDE, NT, TN, CHUNK,NTHREADS,TID
INTEGER,VALUE :: XDIM,YDIM,TSTEP
INTEGER1 :: JLL(:,:,:)
INTEGER
2 :: STATUS
REAL :: DKSI,DETA,FORCEX,FORCEY,&
CT,Z0,KZ,TAU,OM,TETA,TAUT

REAL :: H(:,:),U(:,:,:),UKAR(:,:,:),ZB(:,:),KHZM(:,:)
REAL :: F(:,:,:),FEQ(0:8),FORCEL(0:8),S(0:8)

REAL :: FEQ1,FEQ2,FEQ3,FEQ4,FEQ5,FEQ6,FEQ7,FEQ8

REAL :: G11(:,:),G22(:,:),G12(:,:),JA(:,:),&
G22JAKSI(:,:,:),G22JAETA(:,:),G11JAKSI(:,:),G11JAETA(:,:,:),&
DXKSI(:,:),DXETA(:,:),DYKSI(:,:),DYETA(:,:),&
DJAKSI(:,:),DJAETA(:,:),&
DXKSIKSI(:,:),DYKSIKSI(:,:),DXETAKSI(:,:),DYETAKSI(:,:),&
DXETAETA(:,:),DYETAETA(:,:),VIS(:,:),VISE(:,:)

REAL :: HINT,HINTS,HINTSS,U1INT,U2INT,U1INTS,U2INTS,UKAR1INT,UKAR2INT

REAL :: G22INT,G12INT,G11INT,JAINT,DXKSIINT,DXETAINT,DYKSIINT,DYETAINT,&
DXKSIKSIINT,DYKSIKSIINT,DXETAKSIINT,DYETAKSIINT,DXETAETAINT,DYETAETAINT,&
DJAKSIINT,DJAETAINT,KGINT,TXXINT,TYYINT,TXYINT,HUKSIINT,HUETAINT,HVKSIINT,HVETAINT

REAL :: MT(9,9),MMF(1:9),MINV(9,9),DF(1:9),DDF(1:9),C(0:8),SD(1:9),PR,CR,SP
REAL,VALUE :: SR2,SR3,SR5,SR7,MKH,G,EX,EY,DT,KKV,TSX,TSY
REAL :: TIME1, TIME2, TIMETOT


COMMON/GRIDPARAM/DKSI,DETA,RDKDE


X=(BLOCKIDX%X-1)*BLOCKDIM%X+THREADIDX%X
Y=(BLOCKIDX%Y-1)*BLOCKDIM%Y+THREADIDX%Y

FORCEL=0.0
TETA=0.5

DO I=0,8
!
! PRORACUN HIDRAULICKIH KOMPONENTI STRUJANJA NA POLOVINI LINKA
!
IF (I.EQ.0) THEN
J=0
ELSE
J=JLL(I,X,Y)
ENDIF

HINT = (H(X,Y)+H(X+E(J,1),Y+E(J,2)))*0.5
HINTS = (H(X,Y)**2.+H(X+E(J,1),Y+E(J,2))**2.)*0.5
HINTSS = (H(X,Y)**0.333+H(X+E(J,1),Y+E(J,2))**0.333)*0.5
U1INT = (U(1,X,Y)+U(1,X+E(J,1),Y+E(J,2)))*0.5
U2INT = (U(2,X,Y)+U(2,X+E(J,1),Y+E(J,2)))*0.5
UKAR1INT = (UKAR(1,X,Y)+UKAR(1,X+E(J,1),Y+E(J,2)))*0.5
UKAR2INT = (UKAR(2,X,Y)+UKAR(2,X+E(J,1),Y+E(J,2)))*0.5
U1INTS = (U(1,X,Y)**2.+U(1,X+E(J,1),Y+E(J,2))**2.)*0.5
U2INTS = (U(2,X,Y)**2.+U(2,X+E(J,1),Y+E(J,2))**2.)*0.5
G22INT = (G22_D(X,Y)+G22_D(X+E(J,1),Y+E(J,2)))*0.5
G12INT = (G12_D(X,Y)+G12_D(X+E(J,1),Y+E(J,2)))*0.5
G11INT = (G11_D(X,Y)+G11_D(X+E(J,1),Y+E(J,2)))*0.5
JAINT = (JA_D(X,Y)+JA_D(X+E(J,1),Y+E(J,2)))*0.5

DXKSIINT = (DXKSI_D(X,Y)+DXKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DXETAINT = (DXETA_D(X,Y)+DXETA_D(X+E(J,1),Y+E(J,2)))*0.5
DYKSIINT = (DYKSI_D(X,Y)+DYKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DYETAINT = (DYETA_D(X,Y)+DYETA_D(X+E(J,1),Y+E(J,2)))*0.5
DXKSIKSIINT = (DXKSIKSI_D(X,Y)+DXKSIKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DYKSIKSIINT = (DYKSIKSI_D(X,Y)+DYKSIKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DXETAKSIINT = (DXETAKSI_D(X,Y)+DXETAKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DYETAKSIINT = (DYETAKSI_D(X,Y)+DYETAKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DXETAETAINT = (DXETAETA_D(X,Y)+DXETAETA_D(X+E(J,1),Y+E(J,2)))*0.5
DYETAETAINT = (DYETAETA_D(X,Y)+DYETAETA_D(X+E(J,1),Y+E(J,2)))*0.5

DJAKSIINT = (DJAKSI_D(X,Y)+DJAKSI_D(X+E(J,1),Y+E(J,2)))*0.5
DJAETAINT = (DJAETA_D(X,Y)+DJAETA_D(X+E(J,1),Y+E(J,2)))*0.5

!****************************************
! PRORACUN CLANA SILE U X I Y PRAVCU *
!****************************************

CT = G*MKH**2. / HINTSS
KZ = KHZM(X,Y)

FORCEX=-((CT + KZ) * U1INTJAINT**2.)&
SQRT(U1INTSG11INT+2.U1INTU2INTG12INT+U2INTS*G22INT)&

+(JAINT/1000.)(DYETAINTTSX-DXETAINT*TSY)&

-JAINTHINTUKAR2INT*(DXETAKSIINTU1INT+DXETAETAINTU2INT)&
+JAINTHINTUKAR1INT*(DYETAKSIINTU1INT+DYETAETAINTU2INT)


FORCEY=-((CT + KZ) * U2INTJAINT**2.)&
SQRT(U1INTSG11INT+2.U1INTU2INTG12INT+U2INTS*G22INT)&

+(JAINT/1000.)(-DYKSIINTTSX+DXKSIINT*TSY)&

+JAINTHINTUKAR2INT*(DXKSIKSIINTU1INT+DXETAKSIINTU2INT)&
-JAINTHINTUKAR1INT*(DYKSIKSIINTU1INT+DYETAKSIINTU2INT)

!**************************************************************************
! PRORACUN CLANA EKVILIBRIJUMA, SILE I CLANA S ZA SVE LINKOVE I= 0 - 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3.HINTU1INT*(G11JAKSI_D(X+E(J,1),Y+E(J,2))-G11JAKSI_D(X,Y))/((EY*E(I,2))**2.)

ELSEIF (I.EQ.2 .OR. I.EQ.4 .OR. I.EQ.6 .OR. I.EQ.8) THEN

! PRAVCI I=2,4,6,8

MMF(I+1) = F(I,X,Y)-( (U(1,X,Y)*JA_D(X,Y)**2.)/(12.EXE(I,1)) + (U(2,X,Y)*JA_D(X,Y)**2.)/(12.EYE(I,2)) +&
(U(1,X,Y)*U(2,X,Y)*JA_D(X,Y)**2.)/(4.EXE(I,1)EYE(I,2)) ) * H(X,Y)-&

( H(X,Y)VIS(X,Y)/JA_D(X,Y)(G11_D(X,Y)*(UKAR(2,X,Y)*DXETAETA_D(X,Y) - UKAR(1,X,Y)DYETAETA_D(X,Y))+&
G22_D(X,Y)
(UKAR(1,X,Y)*DYKSIKSI_D(X,Y) - UKAR(2,X,Y)DXKSIKSI_D(X,Y))+&
JA_D(X,Y)**4.
(UKAR(1,X,Y)G11JAETA_D(2,X,Y)+UKAR(2,X,Y)G22JAKSI_D(2,X,Y))) )/&
(4
EX
E(I,1)EYE(I,2))

FORCEL(I)=FORCEX/(EXE(I,1)6.)+FORCEY/(EYE(I,2)6.)+(JAINTHINTU1INTDJAKSIINT+JAINTHINTU2INTDJAETAINT)/6.

S(I)=(G/4.HINTG12INT*( (ZB_D(X+E(J,1),Y+E(J,2))-ZB_D(X,Y)) + (H(X+E(J,1),Y+E(J,2))-H(X,Y))) )/(EX*E(I,1)EYE(I,2))

ENDIF
ENDDO

! PRAVAC I=0

!FEQ(0) = JA(X,Y)2.H(X,Y)-(FEQ(1)+FEQ(2)+FEQ(3)+FEQ(4)+&
! FEQ(5)+FEQ(6)+FEQ(7)+FEQ(8))




!
**********************************
! PRORACUN VREMENA RELAKSACIJE TAU *
!*************************************

! IF (DKSI.EQ.DETA) THEN
OM=(TETA*G22_D(X,Y)+(1.-TETA)*G11_D(X,Y))/JA_D(X,Y)**2.
! ELSE
! OM=(G11(X,Y)/JA(X,Y)**2.)/(EY/EX)
! ENDIF

TAUT = VIS(X,Y)OM3.0/(DTEXEY)+0.5

!****************
! CLAN SUDARA *
!****************

! LBGK METOD

!DO K = 0, 8

!F(K,X,Y) = (1.0D0 - 1.0/TAUT) * F(K,X,Y) + (1.0/TAUT) * FEQ(K) + DT * FORCEL(K)+S(K)
!SK(X,Y) = (F(I,X,Y)*LOG(F(I,X,Y)/FEQ(I))) + SK(X,Y)

!ENDDO

! DO I = 0, 4
! FTUR(I,X,Y) = (1.0D0 - 1.0/TAUTUR) * FTUR(I,X,Y) + (1.0/TAUTUR) * FEQTUR(I) + DT * FORCETURB(I)
! ENDDO


!
! MRT METOD
!
SD(1)=1.0
SD(2)=SR2
SD(3)=SR3
SD(4)=1.0
SD(5)=SR5
SD(6)=1.0
SD(7)=SR7
SD(8)=1./TAUT
SD(9)=1./TAUT

! CALL MURRV (MT, MMF(:), DF)
! CALL MURRV (SD,DF,DDF)
! CALL MURRV (MINV,DDF,C)

!MMF(:)=F(:,X,Y)-FEQ(:)
!DF = MATMUL(MT,MMF)
!DDF = MATMUL(SD,DF)
!C = MATMUL(MINV,DDF)

!MMF(:)=F(:,X,Y)-FEQ(:)
call syncthreads()

DO I=1,9
PR=0.0
DO K=1,9
!PR=PR+(MT(I,K)MMF(K))
ENDDO
DDF(I)=PR
SD(I)
ENDDO

DO I = 0, 8

CR=0.0
DO J=0, 8
!CR=CR+(MINV(I+1,J+1)*DDF(J+1))
!C(I)=CR
ENDDO

!F(I,X,Y) = F(I,X,Y) - CR + DT * FORCEL(I) + S(I)

ENDDO


!CALL CPU_TIME(time2)
!TIMETOT = TIMETOT + (TIME2-TIME1)

!WRITE(,)
!WRITE(,) ‘TIME=’,TIMETOT/60.0 ,‘minutes’
!WRITE(,)
!PAUSE

END SUBROUTINE EQUIL_FORCE_S_COLLIDE
END MODULE EQFORCCOLL


PROGRAM MAINLBGK

USE D2Q9CONST
USE UL
USE GEOM
USE CSTR
USE TRMTR
USE INIT
USE EQFORCCOLL
USE CUDAFOR

IMPLICIT NONE

! INCLUDE ‘LINK_FNL_SHARED.H’

INTEGER :: I,J,XDIM,YDIM,TSTEP,RDKDE
INTEGER :: TMAX,DIMQZ,IDWR,BROGR,DIMTEC
INTEGER :: ISTAT,errCode
INTEGER1,ALLOCATABLE :: IMAGE(:,:),OPBND(:,:),JLL(:,:,:)
INTEGER
2,ALLOCATABLE :: DIMTP(:,:),IMAGES(:,:),ITZ(:,:),IM(:,:)
INTEGER,ALLOCATABLE :: GRAN(:,:),DIMTIZP(:,:),TEC(:)
REAL,ALLOCATABLE :: G11(:,:), G22(:,:),G12(:,:),JA(:,:),ZB(:,:),&
DXKSI(:,:),DXETA(:,:),DYKSI(:,:),DYETA(:,:),&
XCOR(:,:),YCOR(:,:),DJAKSI(:,:),DJAETA(:,:),&
G22KSI(:,:),G11ETA(:,:),G22JAKSI(:,:,:),G22JAETA(:,:),G11JAKSI(:,:),G11JAETA(:,:,:)
REAL,ALLOCATABLE :: DXKSIKSI(:,:),DYKSIKSI(:,:),DXETAKSI(:,:),DYETAKSI(:,:),&
DXETAETA(:,:),DYETAETA(:,:)
REAL,ALLOCATABLE :: F(:,:,:),U(:,:,:),UKAR(:,:,:),H(:,:),&
VIS(:,:),VISE(:,:),KG(:,:),FTUR(:,:,:),KHZM(:,:),QZ(:,:)
REAL,ALLOCATABLE :: PROM1(:,:),PROM2(:,:),DZB(:,:)
REAL :: EX,EY,DT,KT,OM,KKV,HIN,MKH,KHZ,G,HP,DEL
REAL :: BCP,FP,INP,OUTP
REAL :: DKSI,DETA
REAL :: MT(9,9),MINV(9,9)
REAL :: TAUTUR,CKK,CV,CE
REAL :: TIME1, TIME2, TIMETOT, STOP_CLOCK, START_CLOCK
REAL :: TSX,TSY,SR2,SR3,SR5,SR7
!
! CUDA PARAMETRI
!
TYPE(DIM3) :: GRID,TBLOCK
REAL,ALLOCATABLE,DEVICE:: F_D(:,:,:),U_D(:,:,:),UKAR_D(:,:,:),H_D(:,:),VIS_D(:,:),VISE_D(:,:),KHZM_D(:,:)
REAL,DEVICE :: MT_D(9,9),MINV_D(9,9)
INTEGER1,DEVICE,ALLOCATABLE :: JLL_D(:,:,:)


CHARACTER
100 PROJECT

COMMON/DIM/XDIM,YDIM
COMMON/GRIDPARAM/DKSI,DETA
COMMON/TIMEPARAM/TMAX,DT
COMMON/FLOWPARAM/KKV,HIN,MKH,KHZ,G,HP
COMMON/CONPARAM/BCP,FP,INP,OUTP
COMMON/KTURBPARAM/TAUTUR,CKK,CV,CE
COMMON/RELAXPARAM/SR2,SR3,SR5,SR7
COMMON/TECPARAM/DIMTEC
COMMON/WINDPARAM/TSX,TSY

OPEN(11,FILE=‘PROJECT.INP’)
READ(11,"(A100)") PROJECT
OPEN(1,FILE=PROJECT,ACTION=‘READ’)
OPEN(2,FILE=‘TIZLAZ.PLT’)

CALL GEOMETRIJA(XCOR,YCOR,G11,G12,G22,JA,ZB,DXKSI,DXETA,DYKSI,DYETA,&
DJAKSI,DJAETA,G22KSI,G11ETA,&
DXKSIKSI,DYKSIKSI,DXETAKSI,DYETAKSI,&
DXETAETA,DYETAETA,G22JAKSI,G22JAETA,G11JAKSI,G11JAETA)

ALLOCATE(F(0:8,XDIM,YDIM),FTUR(0:4,XDIM,YDIM))
ALLOCATE(U(1:2,XDIM,YDIM),UKAR(1:2,XDIM,YDIM),H(XDIM,YDIM),&
VIS(XDIM,YDIM),VISE(XDIM,YDIM),KG(XDIM,YDIM),&
PROM1(XDIM,YDIM),PROM2(XDIM,YDIM))

ALLOCATE(F_D(0:8,XDIM,YDIM),U_D(1:2,XDIM,YDIM),UKAR_D(1:2,XDIM,YDIM),H_D(XDIM,YDIM),&
VIS_D(XDIM,YDIM),VISE_D(XDIM,YDIM),KHZM_D(XDIM,YDIM),JLL_D(8,XDIM,YDIM))

ALLOCATE(ZB_D(XDIM,YDIM),G11_D(XDIM,YDIM),G22_D(XDIM,YDIM),G12_D(XDIM,YDIM),JA_D(XDIM,YDIM),&
DJAKSI_D(XDIM,YDIM),DJAETA_D(XDIM,YDIM),&
DXKSI_D(XDIM,YDIM),DXETA_D(XDIM,YDIM),DYKSI_D(XDIM,YDIM),DYETA_D(XDIM,YDIM),&
G22JAKSI_D(1:2,XDIM,YDIM),G22JAETA_D(XDIM,YDIM),G11JAKSI_D(XDIM,YDIM),G11JAETA_D(1:2,XDIM,YDIM),&
DXKSIKSI_D(XDIM,YDIM),DYKSIKSI_D(XDIM,YDIM),DXETAKSI_D(XDIM,YDIM),&
DYETAKSI_D(XDIM,YDIM),DXETAETA_D(XDIM,YDIM),DYETAETA_D(XDIM,YDIM))

CALL ULAZ(DIMTP,DIMTIZP,ITZ,GRAN,QZ,IM,VIS,TEC)

U=0.0
VISE=0.0
UKAR=0.0
F=0.0
FTUR=0.0
KG=0.0
KT=DT

CALL INITIAL(U,UKAR,H,HIN,G11,G22,DXKSI,DXETA,DYKSI,DYETA,JA,ZB,GRAN,QZ,KKV,VIS,XDIM,YDIM)
CALL CSTRIMAGE(H,IMAGE,IMAGES,OPBND,EX,EY,DT,GRAN,HP,ITZ,KHZ,KHZM,IM,JLL,XDIM,YDIM)
CALL TRANSMATRIX(EX,EY,DT,MT,MINV,JA,H)
CALL EQUILIBRIUM_INIT(F,H,U,EX,EY,G11,G22,G12,JA,G,G22JAKSI,G11JAETA,VIS,VISE,KG,FTUR,UKAR,&
DXKSIKSI,DYKSIKSI,DXETAKSI,DYETAKSI,DXETAETA,DYETAETA,DT)



CALL CPU_TIME(TIME1)

TBLOCK=DIM3(16,16,1)
GRID=DIM3(CEILING(REAL(XDIM)/TBLOCK%X),CEILING(REAL(YDIM)/TBLOCK%Y),1)

VIS_D =VIS
VISE_D =VISE
KHZM_D =KHZM
JLL_D =JLL
MT_D =MT
MINV_D =MINV

G11_D =G11
G22_D =G22
G12_D =G12
JA_D =JA
DJAKSI_D =DJAKSI
DJAETA_D =DJAETA
DXKSI_D =DXKSI
DXETA_D =DXETA
DYKSI_D =DYKSI
DYETA_D =DYETA
G22JAKSI_D =G22JAKSI
G22JAETA_D =G22JAETA
G11JAKSI_D =G11JAKSI
G11JAETA_D =G11JAETA
DXKSIKSI_D =DXKSIKSI
DYKSIKSI_D =DYKSIKSI
DXETAKSI_D =DXETAKSI
DYETAKSI_D =DYETAKSI
DXETAETA_D =DXETAETA
DYETAETA_D =DYETAETA
ZB_D =ZB


DO TSTEP = 1,TMAX

F_D =F
H_D =H
U_D =U
UKAR_D =UKAR

CALL UNSTBCOND(U,UKAR,H,HIN,G11,G22,DXKSI,DXETA,DYKSI,DYETA,JA,ZB,GRAN,QZ,KKV,VIS,KT)

CALL EQUIL_FORCE_S_COLLIDE<<<GRID,TBLOCK>>>(F_D,U_D,H_D,UKAR_D,EX,EY,&
VIS_D,DT,G,MKH,KHZM_D,JLL_D,KKV,&
MT_D,MINV_D,TSTEP,XDIM,YDIM,TSX,TSY,&
SR2,SR3,SR5,SR7)
F =F_D

CALL STREAM(F,FTUR)
CALL INOUT_BOUND_MACROS(F,FTUR,H,U,IMAGES,JA,HIN,INP,OUTP,BCP,EX,EY,&
UKAR,KG,DXKSI,DXETA,DYKSI,DYETA,TSTEP,OPBND,DEL,DIMTIZP)
!
! ZAPIS REZULTATA U FORMATU TECPLOT APLIKACIJE U ZADATIM VREMENSKIM PRESECIMA
!
DO I=1,DIMTEC
PROM1=G22
PROM2=G11
IF (TSTEP.EQ.TEC(I)) CALL TECPLOT(XCOR,YCOR,U,UKAR,H,ZB,&
DXKSI,DXETA,DYKSI,DYETA,JA,G11,G12,G22,&
PROM1,PROM2,VIS,VISE,DIMTP,IMAGE,TSTEP)

ENDDO


!WRITE(,)
!WRITE(,) ‘KORAK=’,TSTEP
!WRITE(,)

10 ENDDO
CALL CPU_TIME(time2)
TIMETOT = TIMETOT + (TIME2-TIME1)

DEALLOCATE(F_D,U_D,UKAR_D,H_D,VIS_D,VISE_D,KHZM_D,JLL_D,ZB_D,G11_D,G22_D,G12_D,JA_D,&
DJAKSI_D,DJAETA_D,DXKSI_D,DXETA_D,DYKSI_D,DYETA_D,&
G22JAKSI_D,G22JAETA_D,G11JAKSI_D,G11JAETA_D,DXKSIKSI_D,DYKSIKSI_D,DXETAKSI_D,&
DYETAKSI_D,DXETAETA_D,DYETAETA_D,F,U,UKAR,H,VIS,VISE,KHZM,JLL,ZB,G11,G22,G12,JA,&
DJAKSI,DJAETA,DXKSI,DXETA,DYKSI,DYETA,&
G22JAKSI,G22JAETA,G11JAKSI,G11JAETA,DXKSIKSI,DYKSIKSI,DXETAKSI,&
DYETAKSI,DXETAETA,DYETAETA)



WRITE(,)
WRITE(,) ‘TIME=’,TIMETOT/60.0 ,‘minutes’
WRITE(,)
WRITE(,) ‘SPEED=’,DBLE(TMAX) * (DBLE(XDIM * YDIM)) / TIMETOT ,‘cells per second’
WRITE(,)
PAUSE

ISTAT=CUDADEVICERESET()

END PROGRAM MAINLBGK
After running on the emulation mode, I get the following message :

error S0186 : Argument missing for formal argument threadidx

Thank you in advance.

Ljubomir

Hi Ljubomir,

I don’t see anything obvious so will need to run the program to determine the cause of the error. Can you please send the whole program, including the dependent modules and data sets, to PGI Customer Service (trs@pgroup.com) and ask them to forward it to me?

Thanks,
Mat

Hi Mat,
Thank you for your help and support.
Regarding my last post, I’m just informing you that I have solved the code problem without using the emulation mode. The problem was in the source coding. However, I want to ask you two questions about my graphic card and the available Fortran debug programs :

  1. I have GeForce 420 GT graphic card and my question is about compute computability. It is stated on Nvidia site that the compute capability for this card is 1.0, while the device query shows 2.1. Can you please make it clear what is the reason of this difference, and can I use the double-precision floating-point format?

  2. Is there any available debug software for CUDA Fortran application?

Thank you in advance.

Ljuba