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

problems using vsrngexponential

emilio_ghiani
Beginner
1,626 Views
Dear collegues,
I am trying to implement the generator of exponentially distributed random numbers vsrngexponential, and I am experiencing some problems.

The visual fortran 2008 compiler gives me this error:

Error 19 error #6218: This statement is positioned incorrectly and/or has syntax errors. C:\Programmi\Intel\Compiler\11.1\051\mkl\include\mkl_vsl.fi 1

The error is related to the first line of the file mkl_vsl.fi with the name of the module>> Module MKL_VSL_TYPE (???)

The compiler provide also further several errors related to variables included in the file mkl_vsl.fi

Please, I would like to have a working example with the use of vsrngexponential (with fortran code). The information available on Math Kernel Library -Vector Statistical Library Notes, is not sufficient for understanding how to implement the function.

Any help is very welcome.
Tankyou
0 Kudos
1 Solution
Gennady_F_Intel
Moderator
1,626 Views
I assume that you work in MS* Visual Studio with integrated support of Intel Visual Fortran Compiler. In this case you would need to open properties of your project (Project->Properties), then choose Configuration properties->Fortran-> General and fill in "Additional Include Directories" field with the path I have specified earlier. Following this way I successfully built and run the example in my MSVS2005 using Visual Fortran 11.1 compiler. Please, let me know how it now works.
Thanks,
Andrey

emilio,
Please look at the attachment.
This zip contains MVSC2005 project with vsrngexponential.f ( the code was slightly modified by commenting some additional routines like CheckErrors ).
As an additionally, I added to this zip the makefile if you don't need to use VS IDE.
--Gennady

View solution in original post

0 Kudos
9 Replies
Chao_Y_Intel
Moderator
1,626 Views

Hello,

There is anexample for vsrngexponential function:
mklexamplesvslfsourcevsrngexponential.f

Check if it can work for you?

Thanks,
Chao

0 Kudos
emilio_ghiani
Beginner
1,626 Views
Quoting - Chao Y (Intel)

Hello,

There is anexample for vsrngexponential function:
mklexamplesvslfsourcevsrngexponential.f

Check if it can work for you?

Thanks,
Chao


in the example there is the lines

USE MKL_VSL_TYPE
USE MKL_VSL

implicit none
include 'mkl_vsl.fi'
include "errcheck.inc"

that I am using also in my project.
When I try to compile the project there are 31 errors that seem to be in themkl_vsl.fi :

Error 1 error #6218: This statement is positioned incorrectly and/or has syntax errors. C:ProgrammiIntelCompiler11.1�51mklincludemkl_vsl.fi line 1

( the statement is the module name ??)

Error 2 error #6401: The attributes of this name conflict with those made accessible by a USE statement. [VSL_STATUS_OK] C:ProgrammiIntelCompiler11.1�51mklincludemkl_vsl.fi line 7
Error 3 error #6401: The attributes of this name conflict with those made accessible by a USE statement. [VSL_ERROR_OK] C:ProgrammiIntelCompiler11.1�51mklincludemkl_vsl.fi 8
Error 4 error #6401: The attributes of this name conflict with those made accessible by a USE statement. [VSL_ERROR_FEATURE_NOT_IMPLEMENTED] C:ProgrammiIntelCompiler11.1�51mklincludemkl_vsl.fi 13
Error 5 error #6401: The attributes of this name conflict with those made accessible by a USE statement. [VSL_ERROR_UNKNOWN] C:ProgrammiIntelCompiler11.1�51mklincludemkl_vsl.fi 14

and so on...
I tried also to add libraries and include paths but it does not works.

trying to use the example you suggest I have this error

Error 1 error #5102: Cannot open include file 'errcheck.inc' C:Documents and SettingsEMILIO GHIANIDesktopSPREAD_MCSPREAD_MCSources_SPREAD_ERSE_FORTRAN_NEWVAMM_MARKOV_STATE.f90 20

Please suggest possible solutions.
Thanks






0 Kudos
Andrey_N_Intel
Employee
1,626 Views

Hello,
Can you please make sure that in your application you first include mkl_vsl.fi file and then use MKL_VSL_TYPE and MKL_VSL as shown in the VSL example that makes call tothe exponential distribution generator?

include 'mkl_vsl.fi'
...
program MKL_VSL_TEST

USE MKL_VSL_TYPE
USE MKL_VSL
...


Thanks,
Andrey
0 Kudos
emilio_ghiani
Beginner
1,626 Views

Hello,
Can you please make sure that in your application you first include mkl_vsl.fi file and then use MKL_VSL_TYPE and MKL_VSL as shown in the VSL example that makes call tothe exponential distribution generator?

include 'mkl_vsl.fi'
...
program MKL_VSL_TEST

USE MKL_VSL_TYPE
USE MKL_VSL
...


Thanks,
Andrey
!*******************************************************************************
! Content:
! vsRngExponential Example Program Text
!*******************************************************************************

include 'mkl_vsl.fi'
include "errcheck.inc"

program MKL_VSL_TEST



USE MKL_VSL_TYPE
USE MKL_VSL

integer(kind=4) i,nn
integer n
integer(kind=4) errcode

real(kind=4) a,beta
real(kind=4) r(1000)
integer brng,method,seed

real(kind=8) tM,tD,tQ,tD2
real(kind=8) sM,sD
real(kind=8) sum, sum2
real(kind=8) s
real(kind=8) DeltaM,DeltaD

TYPE (VSL_STREAM_STATE) :: stream

n=1000
nn=10

brng=VSL_BRNG_MCG31
method=0
seed=777

a=0.0
beta=1.0

! ***** Initialize *****
errcode=vslnewstream( stream, brng, seed )
call CheckVslError(errcode)

! ***** Call RNG *****
errcode=vsrngexponential( method, stream, n, r, a, beta)
call CheckVslError(errcode)

etc etc
.............................................................

As you ca see I am using the example you provide with the software


0 Kudos
Andrey_N_Intel
Employee
1,626 Views
To compile and run the VSL example you would need to add subdirectory .examplesvslfsource of your MKL directory to Include paths of your project. This subdirectory contains file errcheck.inc which is necessary to build the example. Please, let me know how it works for you.
Thanks,
Andrey
0 Kudos
emilio_ghiani
Beginner
1,626 Views
To compile and run the VSL example you would need to add subdirectory .examplesvslfsource of your MKL directory to Include paths of your project. This subdirectory contains file errcheck.inc which is necessary to build the example. Please, let me know how it works for you.
Thanks,
Andrey

Please be more clear with your explanation.
I do not understand how/where I have to add the subdirectory.



0 Kudos
Andrey_N_Intel
Employee
1,626 Views
I assume that you work in MS* Visual Studio with integrated support of Intel Visual Fortran Compiler. In this case you would need to open properties of your project (Project->Properties), then choose Configuration properties->Fortran-> General and fill in "Additional Include Directories" field with the path I have specified earlier. Following this way I successfully built and run the example in my MSVS2005 using Visual Fortran 11.1 compiler. Please, let me know how it now works.
Thanks,
Andrey

0 Kudos
Gennady_F_Intel
Moderator
1,627 Views
I assume that you work in MS* Visual Studio with integrated support of Intel Visual Fortran Compiler. In this case you would need to open properties of your project (Project->Properties), then choose Configuration properties->Fortran-> General and fill in "Additional Include Directories" field with the path I have specified earlier. Following this way I successfully built and run the example in my MSVS2005 using Visual Fortran 11.1 compiler. Please, let me know how it now works.
Thanks,
Andrey

emilio,
Please look at the attachment.
This zip contains MVSC2005 project with vsrngexponential.f ( the code was slightly modified by commenting some additional routines like CheckErrors ).
As an additionally, I added to this zip the makefile if you don't need to use VS IDE.
--Gennady
0 Kudos
Gennady_F_Intel
Moderator
1,626 Views
emilio,
Please look at the attachment.
This zip contains MVSC2005 project with vsrngexponential.f ( the code was slightly modified by commenting some additional routines like CheckErrors ).
As an additionally, I added to this zip the makefile if you don't need to use VS IDE.
--Gennady

some more comments regarding the attached project:
1) I used Intel Fortran Compiler v.10.1
2) and standalone version of MKL version 10.2 Update 3
3) win32
if you are using Visual Fortran 11.1 ( as Andrey mentioned above) you just need to change the pathes to the bundled MKL
--Gennady
0 Kudos
Reply