Unexpectef Output

I have the main program like this:

call chemical_reaction<<<1,100>>>(y_d,temp_d,rho_d,z_d,method,dt
& , imech, isolver,GasCon,Press
& ,Coef_d)

! **copy again to the host
iastat=cudaDeviceSynchronize()
if (iastat /= cudaSuccess) write(,) cudaGetErrorString(iastat)
enth=enth_d
temp=temp_d
rho=rho_d
y=y_d
z=z_d
print*,enth,temp,rho
stop

where the function chemical_reaction is defined as follows

attributes(global) subroutine chemical_reaction(yk,tempk,rhok,
& zk,methodk,dtk,imechk
& ,isolverk,gascon_d,press_d,coef_d)
use chem_mod_d
use rcce_mod_d
implicit none
! arguments**
double precision,device, dimension(100) :: enthk, tempk, rhok
double precision,device, dimension(53,100) :: yk
double precision,device, dimension(100) :: zk
integer, value :: methodk, imechk, isolverk
double precision, value :: dtk, falimk, ff_flam_mink,ff_flam_maxk
double precision,device, dimension(2,7,53) :: coef_d
double precision,value :: GasCon_d,press_d
! local_variables****
double precision :: enth1, temp1, rho1
double precision, dimension(53) :: F_mol
integer i
! control_parameters*
i=threadidx%x+(blockidx%x-1)blockdim%x
! execution
***
F_mol=yk(:,i)
enth1=enthk(i)
temp1=tempk(i)
rho1=rhok(i)

rho1=enth1

yk(:,i)=F_mol
enthk(i)=enth1
tempk(i)=temp1
rhok(i)=rho1
end subroutine chemical_reaction

So, this function should copy the values of enth1 to rho1 for each thread and so the array
rhok should contain the enthk values. But instead of this I get an strange output like this.

NaN -6.5354033241107468E+144 -4.8579438674133882E+149
1.9578881854846901E+269 ******************** 7.0641575457362301E-304
-6.5142805056262458E+303 6.1669851612137831E-304 -3.1045727094128839E+231
NaN -1.2961434396156444E+304 -3.3017189971762829E+268
1.1903952152261742E-287 ******************** -3.9869972208399978E+255

I don’t know why that is happening. Thanks

Hi ElMaskina,

You declare “enthk” under “aguments” section but I don’t see it in the argument list. Am I missing something or is it suppose to be passed in?

  • Mat

Many thanks, stupid error.