- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, you have to compile this file first, in order to create MKL_VSL_TYPE.MOD and then you must USE MKL_VSL_TYPE in files that are compiled later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash]PROGRAM PROVA USE mkl_vsl ... .. . ... ... ... END PROVA[/bash]and then I compile, however it does not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You must add the file 'MKL_VSL.F90' to your project, so that it shows up in the solution explorer pane as a file
You must compile that file in order to create the module MKL_VSL_TYPE.MOD, which you can then USE within your program file to make the VSL definitions available to the program.
So, you have to compile this file first, in order to create MKL_VSL_TYPE.MOD and then you must USE MKL_VSL_TYPE in files that are compiled later.
So change USE MKL_VSL to USE MKL_VSL_TYPE, after you have added MKL_VSL.F90 to your project.
You do understand what adding a file to a project involves I trust?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To make sure thatyour test case can be built and run I did the following steps on Windows* based computer:
1. Created file testcase.f with your code and modified it as shown below:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either change the call to the "vd..." version or remove the -r8 from the command line.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to comment of Les: please, do not forget to use mkl_vsl_type asdescribed inmy previous post,and call service routines to create/delete VSL Random streambefore/aftergeneration of random numbers.
Thanks,
Andrey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page