<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic I have literally the same in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969233#M16416</link>
    <description>&lt;P&gt;I have literally&amp;nbsp;the same problem. Has it been solved since then?&lt;/P&gt;</description>
    <pubDate>Tue, 06 Nov 2018 16:04:39 GMT</pubDate>
    <dc:creator>Osinsky__Alexander</dc:creator>
    <dc:date>2018-11-06T16:04:39Z</dc:date>
    <item>
      <title>fortran+fftw=nan (sometimes)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969226#M16409</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I run a fortran multithreaded code that uses ffts. I am now trying to switch to&lt;/P&gt;

&lt;P&gt;fttw available thru mkl. When I insert the code below the&amp;nbsp; results more&lt;/P&gt;

&lt;P&gt;often than not are nans or infinity even though only the plan call&amp;nbsp; is executed&lt;/P&gt;

&lt;P&gt;and no actuall ffts are carried out using fftw. The standard suspect in such cases&lt;/P&gt;

&lt;P&gt;would be out-of-bounds operations.&amp;nbsp; I cannot at the moment see any out-of-bounds&lt;/P&gt;

&lt;P&gt;problems when creating the plan. But here there is still&amp;nbsp; the problem of the interface.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I wonder if i have set up things correcly. The compile and link calls are&lt;/P&gt;

&lt;P&gt;ifort&amp;nbsp; -O3 -r8&amp;nbsp; -openmp -fpp -parallel -mcmodel=medium -i-dynamic -shared-intel -mkl&lt;/P&gt;

&lt;P&gt;This is run on a six core Linux machine.&lt;/P&gt;

&lt;P&gt;Has anyone any suggestions as to what may be going on?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;--&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;
module FFTW3
    use, intrinsic :: iso_c_binding
    include 'fftw3.f03'
    type(C_PTR), save :: plan_r2c
    real*8, allocatable, SAVE :: WWW1( :, : ), WWW2( :, : )
end module



....

Use FFTW3
Integer :: Irank, ndim(1), InEmbeded(1), OutEmbeded(1)

...

!   Note       NX32 &amp;gt; N1_32 + 4

   allocate( WWW1( NX32*M2, M3  ),  STAT = IERR )
   allocate( WWW2( NX32*M2, M3  ),  STAT = IERR )

  Irank = 1
  ndim(1) = N1_32
  InEmbeded(1)  = NX32
  OutEmbeded(1) = NX32 / 2


 call dfftw_plan_many_dft_r2c( plan_r2c, Irank, ndim(1), M2*M3, WKX_1, InEmbeded(1), 1,    &amp;amp;
                               NX32, WKX_2, OutEmbeded(1), 1, NX32/2, FFTW_MEASURE )

&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2014 18:51:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969226#M16409</guid>
      <dc:creator>a_b_1</dc:creator>
      <dc:date>2014-04-02T18:51:27Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969227#M16410</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Ooops CORRECTION.&lt;/P&gt;

&lt;P&gt;The plan call is:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; call dfftw_plan_many_dft_r2c( plan_r2c, Irank, ndim(1), M2*M3, WWW1, InEmbeded(1), 1, &amp;amp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NX32, WWW2, OutEmbeded(1), 1, NX32/2, FFTW_MEASURE )&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2014 18:58:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969227#M16410</guid>
      <dc:creator>a_b_1</dc:creator>
      <dc:date>2014-04-02T18:58:15Z</dc:date>
    </item>
    <item>
      <title>After the plan call returns,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969228#M16411</link>
      <description>&lt;P&gt;After the plan call returns, did you check if plan_r2c is zero? Probably, the plan was not created successfully for some reason. Can you attach your full test code?&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2014 23:17:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969228#M16411</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2014-04-02T23:17:36Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969229#M16412</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;There is a test for the creation of the plan. See code extract below @ line 98.&lt;/P&gt;

&lt;P&gt;I use fftw with a c code without any problem.&lt;/P&gt;

&lt;P&gt;It is now that I am trying to insert fftw into a fortran code that all&lt;/P&gt;

&lt;P&gt;hell broke loose.&lt;/P&gt;

&lt;P&gt;I include the relevant subroutine (somewhat pruned) that contains the&lt;/P&gt;

&lt;P&gt;relevant call. This is part of a much larger code. The problem is that just&lt;/P&gt;

&lt;P&gt;this one call to the plan routine most times will contaminate with garbage other&lt;/P&gt;

&lt;P&gt;parts of the code.&lt;/P&gt;

&lt;P&gt;Any ideas would be appreciated.&lt;/P&gt;

&lt;P&gt;--&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;!===============================================&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;module FFTW3
    use, intrinsic :: iso_c_binding
    include 'fftw3.f03'
    type(C_PTR), save :: plan_r2c, plan_c2r
    real*8, allocatable, SAVE :: WWW1( :, : ), WWW2( :, : )
end module
!===============================================

Subroutine Setup

Use Tables
Use FFTW3
Implicit None

Integer :: I, J, K, JEL, KEL, Jump, II, JJ, KK
Real*8  :: temp, VS_MAX, T1, T2

Integer :: Irank, ndim(1), InEmbeded(1), OutEmbeded(1)

N1P1 = N1 + 1
N1P2 = N1 + 2

N1_32 = N1 + (N1P1/2)

M2M1 = M2 - 1
M3M1 = M3 - 1

JLEN = N2*M2M1 - 1
KLEN = N3*M3M1 - 1

JFULL = N2*M2M1 + 1
KFULL = N3*M3M1 + 1

JPLEN = N2*M2M1 + 1          ! Pressure matrix y-size
KPLEN = N3*M3M1 + 1          !  ..       ..    z-size


RDT    = 1.0D0 / DT 
RN1_32 = 1.0d0 / DFLOAT(N1_32)

! - Time staping factors

EULER_1 = 1
EULER_2 = 2
NORDER  = EULER_1

! - Euler_1 settings.

Alpha = RDT
Beta  = RDT
Gamma  = 0.0D0

Delta = 1.0D0
Epsilon = 0.0D0

TIME  = 0.0D0
NTIME = 0

N_RANDOM = 0
T_RANDOM = 0

FlowRate_1 = 0.0D0
FlowRate_2 = 0.0D0

[ stuff delete ]

T1 = pi*DFLOAT(N1)/XLEN
Wv( N1+1 ) = T1
Wv_SQ( N1+1 ) = T1*T1

Call FFTFAX( N1,    IFAX,    TRIGS    )
Call FFTFAX( N1_32, IFAX_32, TRIGS_32 )





!===========================================================

!                      FFTW 


   write(6,*)' ----   NX32, N1_32 = ', NX32, N1_32


 &amp;nbsp; allocate( WWW1( NX32*M2, M3&amp;nbsp; ),&amp;nbsp; STAT = IERR )
&amp;nbsp;&amp;nbsp; if( Ierr .ne. 0 ) STOP ' ** FAILED WWWW1 '
&amp;nbsp;&amp;nbsp; allocate( WWW2( NX32*M2, M3&amp;nbsp; ),&amp;nbsp; STAT = IERR )
&amp;nbsp;&amp;nbsp; if( Ierr .ne. 0 ) STOP ' ** FAILED WWWW2 '

  Irank = 1
  ndim(1) = N1_32
  InEmbeded(1)  = NX32
  OutEmbeded(1) = NX32/2



  call dfftw_plan_many_dft_r2c( plan_r2c, Irank, ndim(1), M2*M3, WWW1, InEmbeded(1), 1, &amp;amp;
                               NX32, WWW2, OutEmbeded(1), 1, NX32/2, FFTW_MEASURE )

   if( .not. c_associated(plan_r2c) ) STOP " *** FAILED TO CREAT FFTW PLAN"

   write(6,*) ' --- PLAN ', c_associated(plan_r2c)






! -  Y,Z Grid and parameters.

Call Grid


Call ZWGLJD( YGL, RHY, M2, 0.0D0, 0.0D0 )
Call ZWGLJD( ZGL, RHZ, M3, 0.0D0, 0.0D0 )

Call DGLJD( DYGL, DYGLT, YGL, M2, MY, 0.0D0, 0.0D0 )
Call DGLJD( DZGL, DZGLT, ZGL, M3, MZ, 0.0D0, 0.0D0 )


! - Set up filter data.

Call ZWGLJD( YGL_F, WKP_1, M2_F, 0.0D0, 0.0D0 ) ! Y filter grid. WKP_1 is a dummy.
Call ZWGLJD( ZGL_F, WKP_1, M3_F, 0.0D0, 0.0D0 ) ! Z filter grid. WKP_1 is a dummy.

! - Interpolation matrices : M2 -&amp;gt; M2_F and M3 -&amp;gt; M3_F

Call IGLLMD( GLY2F, WKP_1, YGL, YGL_F, M2, M2_F, MY, MY, -999 )
Call IGLLMD( GLZ2F, WKP_1, ZGL, ZGL_F, M3, M3_F, MZ, MZ, -999 )

! - Reverse interpolation : M2_F -&amp;gt; M2  and  M3_F -&amp;gt; M3

Call IGLLMD( F2GLY, WKP_1, YGL_F, YGL, M2_F, M2, MY, MY, -999 )
Call IGLLMD( F2GLZ, WKP_1, ZGL_F, ZGL, M3_F, M3, MZ, MZ, -999 )

!  [stuff deleted]





End Subroutine Setup&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 19:51:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969229#M16412</guid>
      <dc:creator>a_b_1</dc:creator>
      <dc:date>2014-04-03T19:51:58Z</dc:date>
    </item>
    <item>
      <title>FFTW3 has Fortran interface.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969230#M16413</link>
      <description>&lt;P&gt;FFTW3 has Fortran interface. Why do you use C binding in your Fortran code? Please take a look at the MKL sample code that uses FFTW3 in Fortran code and see if it is helpful. The sample code is found in $MKLROOT/examples/fftw3xf/source/dp_plan_many_dft_r2c.f90&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2014 23:03:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969230#M16413</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2014-04-04T23:03:45Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969231#M16414</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you for your interest.&lt;/P&gt;

&lt;P&gt;I have downloaded a number of test codes . All work ok.&lt;/P&gt;

&lt;P&gt;My problem must be code specific.&lt;/P&gt;

&lt;P&gt;I copied the module with the bindings from fthe fftw site. The c bindings&lt;/P&gt;

&lt;P&gt;are meant to provide fortran types compatible with C which in this case&lt;/P&gt;

&lt;P&gt;is the c_ptr. Anyway this is not the problem.&lt;/P&gt;

&lt;P&gt;if i inderstood the mkl manual correctly,&amp;nbsp; unlike the original fftw, the mkl&lt;/P&gt;

&lt;P&gt;version is not thread safe even when different plans and arrays are used.&lt;/P&gt;

&lt;P&gt;A single muntithreading call is ok tho.&lt;/P&gt;

&lt;P&gt;This is a showstopper, unless u know different.&lt;/P&gt;

&lt;P&gt;--&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 08:56:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969231#M16414</guid>
      <dc:creator>a_b_1</dc:creator>
      <dc:date>2014-04-07T08:56:51Z</dc:date>
    </item>
    <item>
      <title>All MKL functions, including</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969232#M16415</link>
      <description>&lt;P&gt;All MKL functions, including FFT, are thread safe. It is clearly stated in the MKL User's Guide: &lt;A href="http://software.intel.com/en-us/mkl_11.1_ug_lin" target="_blank"&gt;http://software.intel.com/en-us/mkl_11.1_ug_lin&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2014 17:30:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969232#M16415</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2014-04-07T17:30:42Z</dc:date>
    </item>
    <item>
      <title>I have literally the same</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969233#M16416</link>
      <description>&lt;P&gt;I have literally&amp;nbsp;the same problem. Has it been solved since then?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 16:04:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969233#M16416</guid>
      <dc:creator>Osinsky__Alexander</dc:creator>
      <dc:date>2018-11-06T16:04:39Z</dc:date>
    </item>
    <item>
      <title>Hi Alexander,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969234#M16417</link>
      <description>&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;I don't know what&amp;nbsp;problem you are talking about.&amp;nbsp; If your question is about whether or not mkl functions are thread-safe then, just like Zhang has mentioned back in 2014, all mkl functions are thread-safe.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 18:48:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fortran-fftw-nan-sometimes/m-p/969234#M16417</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-07T18:48:54Z</dc:date>
    </item>
  </channel>
</rss>

