Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Do Concurrent, Pure Functions & MKL

Frank_M
Beginner
715 Views

 I have a loop where I am trying to use Do Current. The compiler gives an error on the code

  errcode=vdrnggaussian( method, stream, free_vars, tmp_mutant, 0.0_8, 0.06_8)

  because it claims that vdrnggaussian is not a pure function.

 Is vdrnggaussian really not a Pure function?

 Is there a compiler setting or fortran command which will let fortran treat vdrnggaussian as a Pure function?

 If Do Current will not parallelize vdrnggaussian will OpenMP?

 I don't need a pure clean gaussian function (but it would be nice) and can fake one with the Cosine distribution. Is this my best option?

Thanks

 

0 Kudos
2 Replies
TimP
Honored Contributor III
715 Views

I don't have time right now to look at the MKL USE and .fi files, but you would need to incorporate one of those to provide a declaration of the MKL functions, if in fact they are shown as pure.  But random number generators, by their inherent nature, aren't pure, and the properties of such a generator called from a parallel region can't be relied on. 

You should be able to switch easily between do concurrent and OpenMP DO.

I'm not expert on MKL parallel random number generators, or whether they must be called to populate your arrays before you get into your parallel region.  MKL documentation should cover this, and the MKL forum would be the place to ask questions on that.

There is some advice previously posted on use of MKL for parallel number generation, and I feel a personal obligation to understand some of it, as I'm working on a project right now which was based on a legacy non-standard rng used within Box-Muller framework.  It seems to work OK in a more up to date version using Fortran random_number, but I still have concerns about using this under OpenMP.

In the following thread

http://software.intel.com/en-us/forums/topic/283349

discussions of random_number and VSL rng parallel usage are mixed together.

0 Kudos
Frank_M
Beginner
715 Views

Thanks Tim. That thread looks like it contains most of what I needed.

0 Kudos
Reply