Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6980 Discussions

Help with vdrnggaussian: floating divide by zero

Eric_C_1
Beginner
1,815 Views

Hi all,

I have been using the vdrnggaussian routine to generate normally distributed random numbers. Once in a while however, I get the following error:

 forrtl: error (73): floating divide by zero

I have verified this occurs within the call to vdrnggaussian using write statements before and after. Here is my code:

 

SUBROUTINE reac_diff

! MKL_VSL module included in other routine.

 

        USE MKL_VSL
        USE MKL_VSL_TYPE

 

...

TYPE(VSL_STREAM_STATE) :: fstream

INTEGER, PARAMETER :: Ne=20480

INTEGER :: ferror, rdSeed !rdSeed randomly generated from 1 to 10,000

REAL :: rdmean=0., rdstd=1.

REAL, DIMENSION(Ne) :: frand

        ferror=vslnewstream( fstream,VSL_BRNG_MT19937, rdSeed )

        WRITE(*,*) 'in vdr'
        ferror = vdrnggaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER,fstream,Ne,frand,rdmean,rdstd )    !error occurs in here
        WRITE(*,*) 'out vdr'

 

...

END SUBROUTINE reac_diff

 

I compile with the -r8 flag so the reals are double precision. Compiling with -logo gives:

Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.0.080 Build 20130728
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

 Intel(R) Fortran 14.0-1565
GNU ld (GNU Binutils for Ubuntu) 2.22

 

and using MKL_GET_VERSION_STRING gives

 Intel(R) Math Kernel Library Version 11.1.0 Product Build 20130711 for Intel(R)
  64 architecture applications

 


Any ideas how to prevent the error?

 

 

 

0 Kudos
21 Replies
Gennady_F_Intel
Moderator
375 Views

Eric, there are many ways do check this. The easiest one - you may have a look at the mkl_version.h file ( mklroot/include directory). You will see smth like the follows

#define __INTEL_MKL__ 2017
#define __INTEL_MKL_MINOR__ 0
#define __INTEL_MKL_UPDATE__ 2

 

0 Kudos
Reply