[bash]PROGRAM PROVA USE mkl_vsl IMPLICIT NONE integer status !Error / status integer brng !Index of generator to initialize stream integer method !Method = 0 in case of uniform distribution integer dimen !Initial condition of the stream TYPE (VSL_STREAM_STATE) stream !Random stream integer, PARAMETER :: nr = 1000 !Number of values required (whatever you want) real gauss(nr) real mean, sigma mean = 0.0 sigma = 1.0 !SOBEL method = VSL_METHOD_SGAUSSIAN_ICDF !NB - are different alternatives, but I found this worked well brng = VSL_BRNG_SOBOL dimen = 1 ! <== different values may be needed depending on application gauss = 0.0 status = vslnewstream( stream, brng, dimen ) !Create new stream (SOBOL in this case status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) status = vsldeletestream( stream ) !Delete the stream END[/bash]and I compile as:
[bash]ifort -r8 *.f90 -L$MKLPATH/lib/em64t -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -warn all -check all -debug all[/bash]
[bash]Check INCLUDE paths. [MKL_VSL] USE mkl_vsl ----^ gauss_normally.f90(10): error #6457: This derived type name has not been declared. [VSL_STREAM_STATE] TYPE (VSL_STREAM_STATE) stream !Random stream ------^ gauss_normally.f90(20): error #6404: This name does not have a type, and must have an explicit type. [VSL_METHOD_SGAUSSIAN_ICDF] method = VSL_METHOD_SGAUSSIAN_ICDF !NB - are different alternatives, but I found this worked well ---------^ gauss_normally.f90(21): error #6404: This name does not have a type, and must have an explicit type. [VSL_BRNG_SOBOL] brng = VSL_BRNG_SOBOL -------^ gauss_normally.f90(24): error #6404: This name does not have a type, and must have an explicit type. [STREAM] status = vslnewstream( stream, brng, dimen ) !Create new stream (SOBOL in this case -----------------------^ gauss_normally.f90(24): error #6404: This name does not have a type, and must have an explicit type. [VSLNEWSTREAM] status = vslnewstream( stream, brng, dimen ) !Create new stream (SOBOL in this case ---------^ gauss_normally.f90(25): error #6404: This name does not have a type, and must have an explicit type. [VSRNGGAUSSIAN] status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) ---------^ gauss_normally.f90(26): error #6404: This name does not have a type, and must have an explicit type. [VSLDELETESTREAM] status = vsldeletestream( stream ) !Delete the stream [/bash]
Link Copied
[bash]PROGRAM PROVA USE mkl_vsl ... .. . ... ... ... END PROVA[/bash]and then I compile, however it does not work
include 'mkl_vsl.f90'
PROGRAM PROVA
USE mkl_vsl_type
USE mkl_vsl
...
That is, I additionally included Intel MKL VSL header file and started using mkl_vsl_type.
2. Configured environment by setting variables INCLUDE and LIB to point atinclude andlib folders in my MKL installation directory (I want to link against Intel 64 version of Intel MKL library and use ILP64 interface)
set MKLROOT=...
set INCLUDE=%MKLROOT%\include;%INCLUDE%
set LIB=%MKLROOT%\lib\intel64;%LIB%
I alsoconfigured the environment to use Intel Fortran compiler.
3.Built the testcase by using the build line below:
ifort testcase.f /4I8 mkl_intel_ilp64.lib mkl_sequential.lib mkl_core.lib
The result of the compilationare two mode files and the executable. Please, let me know if this helps.
Rich collection of Fortran VSL examples, available in examples\\vslf\\source directory of Intel MKL installation directory, demonstrates how to use Intel MKL in the applications.
MKLLink advisor, available at http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/,isanotherhelpful tool to configure your build environment.
Thanks,
Andrey
[bash]include 'mkl_vsl.f90' PROGRAM PROVA USE mkl_vsl IMPLICIT NONE integer status !Error / status integer brng !Index of generator to initialize stream integer method !Method = 0 in case of uniform distribution integer dimen !Initial condition of the stream TYPE (VSL_STREAM_STATE) stream !Random stream integer, PARAMETER :: nr = 1000 !Number of values required (whatever you want) real gauss(nr) real mean, sigma mean = 0.0 sigma = 1.0 !SOBEL method = VSL_METHOD_SGAUSSIAN_ICDF !NB - are different alternatives, but I found this worked well brng = VSL_BRNG_SOBOL dimen = 1.d0 ! <== different values may be needed depending on application gauss = 0.0d0 ! status = vslnewstream( stream, brng, dimen ) !Create new stream (SOBOL in this case status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) ! status = vsldeletestream( stream ) !Delete the stream ENDPROGRAM[/bash]
[bash]prova_standanard.f90(25): error #6633: The type of the actual argument differs from the type of the dummy argument. [GAUSS] status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) --------------------------------------------^ prova_standanard.f90(25): error #6633: The type of the actual argument differs from the type of the dummy argument. [MEAN] status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) ---------------------------------------------------^ prova_standanard.f90(25): error #6633: The type of the actual argument differs from the type of the dummy argument. [SIGMA] status = vsrnggaussian( method, stream, nr, gauss, mean, sigma ) [/bash]
For more complete information about compiler optimizations, see our Optimization Notice.