<?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 omp_set_num_threads broken with /iface:cvf on Windows in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795367#M2629</link>
    <description>The omp_set_num_threads() function seems not to have an iface:cvf variant available.&lt;BR /&gt;I'm using this compiler:&lt;BR /&gt; Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.0.233 Build 20110811&lt;BR /&gt;on a 32-bit Windows system.&lt;BR /&gt;&lt;BR /&gt;Take this program proga.f90:&lt;BR /&gt;&lt;BR /&gt; Program main&lt;BR /&gt;  Integer, External :: omp_get_max_threads&lt;BR /&gt;  External :: omp_set_num_threads&lt;BR /&gt;  Integer maxthd&lt;BR /&gt;  maxthd = 2&lt;BR /&gt;  Write(*,*) 'maxthd = ', maxthd&lt;BR /&gt;  Call omp_set_num_threads(maxthd)&lt;BR /&gt;  Write(*,*) 'omp_get_max_threads() returns ', omp_get_max_threads()&lt;BR /&gt; End Program main&lt;BR /&gt;&lt;BR /&gt;and compile it like this:&lt;BR /&gt;&lt;BR /&gt; ifort /Qopenmp proga.f90&lt;BR /&gt;&lt;BR /&gt;Running it you get the expected results:&lt;BR /&gt; proga.exe&lt;BR /&gt; maxthd = 2&lt;BR /&gt; omp_get_max_threads() returns 2&lt;BR /&gt;&lt;BR /&gt;But if you switch on /iface:cvf this happens:&lt;BR /&gt;&lt;BR /&gt; ifort /Qopenmp /iface:cvf proga.f90&lt;BR /&gt; proga.exe&lt;BR /&gt; maxthd = 2&lt;BR /&gt; omp_get_max_threads() returns 32768&lt;BR /&gt;&lt;BR /&gt;In a real OpenMP program that leads to a major resource problem.&lt;BR /&gt;&lt;BR /&gt;I suspect that there is no CVF variant of omp_set_num_threads, and the __cdecl variant always gets linked in instead. If I modify my program to introduce an explicit interface for omp_set_num_threads(), telling the compiler that omp_set_num_threads is in fact __cdecl like this:&lt;BR /&gt;&lt;BR /&gt; Module CPROC&lt;BR /&gt;  Interface&lt;BR /&gt;  Subroutine omp_set_num_threads(n)&lt;BR /&gt;  !DEC$ ATTRIBUTES C :: omp_set_num_threads&lt;BR /&gt;  End Subroutine omp_set_num_threads&lt;BR /&gt;  End Interface&lt;BR /&gt; End Module CPROC&lt;BR /&gt; Program main&lt;BR /&gt;  Use cproc&lt;BR /&gt;  Integer, External :: omp_get_max_threads&lt;BR /&gt; ! external omp_set_num_threads&lt;BR /&gt;  Integer maxthd&lt;BR /&gt;  maxthd = 2&lt;BR /&gt;  Write(*,*) 'maxthd = ', maxthd&lt;BR /&gt;  call omp_set_num_threads(maxthd)&lt;BR /&gt;  Write(*,*) 'omp_get_max_threads() returns ', omp_get_max_threads()&lt;BR /&gt; End Program main&lt;BR /&gt;&lt;BR /&gt;then everything works fine.&lt;BR /&gt;&lt;BR /&gt;Mick Pont&lt;BR /&gt;</description>
    <pubDate>Wed, 07 Mar 2012 09:22:13 GMT</pubDate>
    <dc:creator>Mick_Pont</dc:creator>
    <dc:date>2012-03-07T09:22:13Z</dc:date>
    <item>
      <title>omp_set_num_threads broken with /iface:cvf on Windows</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795367#M2629</link>
      <description>The omp_set_num_threads() function seems not to have an iface:cvf variant available.&lt;BR /&gt;I'm using this compiler:&lt;BR /&gt; Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.0.233 Build 20110811&lt;BR /&gt;on a 32-bit Windows system.&lt;BR /&gt;&lt;BR /&gt;Take this program proga.f90:&lt;BR /&gt;&lt;BR /&gt; Program main&lt;BR /&gt;  Integer, External :: omp_get_max_threads&lt;BR /&gt;  External :: omp_set_num_threads&lt;BR /&gt;  Integer maxthd&lt;BR /&gt;  maxthd = 2&lt;BR /&gt;  Write(*,*) 'maxthd = ', maxthd&lt;BR /&gt;  Call omp_set_num_threads(maxthd)&lt;BR /&gt;  Write(*,*) 'omp_get_max_threads() returns ', omp_get_max_threads()&lt;BR /&gt; End Program main&lt;BR /&gt;&lt;BR /&gt;and compile it like this:&lt;BR /&gt;&lt;BR /&gt; ifort /Qopenmp proga.f90&lt;BR /&gt;&lt;BR /&gt;Running it you get the expected results:&lt;BR /&gt; proga.exe&lt;BR /&gt; maxthd = 2&lt;BR /&gt; omp_get_max_threads() returns 2&lt;BR /&gt;&lt;BR /&gt;But if you switch on /iface:cvf this happens:&lt;BR /&gt;&lt;BR /&gt; ifort /Qopenmp /iface:cvf proga.f90&lt;BR /&gt; proga.exe&lt;BR /&gt; maxthd = 2&lt;BR /&gt; omp_get_max_threads() returns 32768&lt;BR /&gt;&lt;BR /&gt;In a real OpenMP program that leads to a major resource problem.&lt;BR /&gt;&lt;BR /&gt;I suspect that there is no CVF variant of omp_set_num_threads, and the __cdecl variant always gets linked in instead. If I modify my program to introduce an explicit interface for omp_set_num_threads(), telling the compiler that omp_set_num_threads is in fact __cdecl like this:&lt;BR /&gt;&lt;BR /&gt; Module CPROC&lt;BR /&gt;  Interface&lt;BR /&gt;  Subroutine omp_set_num_threads(n)&lt;BR /&gt;  !DEC$ ATTRIBUTES C :: omp_set_num_threads&lt;BR /&gt;  End Subroutine omp_set_num_threads&lt;BR /&gt;  End Interface&lt;BR /&gt; End Module CPROC&lt;BR /&gt; Program main&lt;BR /&gt;  Use cproc&lt;BR /&gt;  Integer, External :: omp_get_max_threads&lt;BR /&gt; ! external omp_set_num_threads&lt;BR /&gt;  Integer maxthd&lt;BR /&gt;  maxthd = 2&lt;BR /&gt;  Write(*,*) 'maxthd = ', maxthd&lt;BR /&gt;  call omp_set_num_threads(maxthd)&lt;BR /&gt;  Write(*,*) 'omp_get_max_threads() returns ', omp_get_max_threads()&lt;BR /&gt; End Program main&lt;BR /&gt;&lt;BR /&gt;then everything works fine.&lt;BR /&gt;&lt;BR /&gt;Mick Pont&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Mar 2012 09:22:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795367#M2629</guid>
      <dc:creator>Mick_Pont</dc:creator>
      <dc:date>2012-03-07T09:22:13Z</dc:date>
    </item>
    <item>
      <title>omp_set_num_threads broken with /iface:cvf on Windows</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795368#M2630</link>
      <description>Sorry - I just realised I accidentally posted this in the MKL forum instead of the ifort compiler forum.&lt;BR /&gt;I will re-post in the correct place.&lt;BR /&gt;&lt;BR /&gt;Mick</description>
      <pubDate>Wed, 07 Mar 2012 11:36:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795368#M2630</guid>
      <dc:creator>Mick_Pont</dc:creator>
      <dc:date>2012-03-07T11:36:56Z</dc:date>
    </item>
    <item>
      <title>omp_set_num_threads broken with /iface:cvf on Windows</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795369#M2631</link>
      <description>Hi Mick.&lt;BR /&gt;&lt;BR /&gt;Your request cannot be solved in compiler's library. The reason is that you want to use the same function and to pass parameter to it using different calling conventions. This will never work, because the function cannot "guess" if it gets the parameter by value or by reference.&lt;BR /&gt;&lt;BR /&gt;In order to not write complex interfaces for all standard OpenMP routines you should usestandard moduleor header provided by the compiler,you can choose any when you need to use OpenMP routines:&lt;BR /&gt; useomp_lib&lt;BR /&gt;or&lt;BR /&gt; include "omp_lib.h"&lt;BR /&gt;&lt;BR /&gt;Using module is prefered variant.Then you can safely specify any allowed calling convention for your own routines. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Andrey&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Mar 2012 13:39:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795369#M2631</guid>
      <dc:creator>Andrey_C_Intel1</dc:creator>
      <dc:date>2012-03-07T13:39:44Z</dc:date>
    </item>
    <item>
      <title>Omp_set_num_threads broken with /iface:cvf on Windows</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795370#M2632</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1331133325125="58" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=545092" href="https://community.intel.com/en-us/profile/545092/" class="basic"&gt;Mick Pont&lt;/A&gt;&lt;/DIV&gt;&lt;DIV style="background-color: #e5e5e5; margin-left: 2px; margin-right: 2px; border: 1px inset; padding: 5px;"&gt;&lt;EM&gt;...&lt;BR /&gt;But if you switch on /iface:cvf this happens:&lt;BR /&gt;&lt;BR /&gt; ifort /Qopenmp /iface:cvf proga.f90&lt;BR /&gt; proga.exe&lt;BR /&gt; maxthd = 2&lt;BR /&gt; omp_get_max_threads() returns &lt;/EM&gt;&lt;STRONG&gt;32768&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;In a real OpenMP program that leads to a major resource problem.&lt;BR /&gt;...&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;Hi Mick,&lt;BR /&gt;&lt;BR /&gt;Didthe applicationreally created &lt;STRONG&gt;32,768&lt;/STRONG&gt; OpenMP threads?&lt;BR /&gt;How much memory was allocated forthe application in thatcase?&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Mar 2012 15:19:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/omp-set-num-threads-broken-with-iface-cvf-on-Windows/m-p/795370#M2632</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2012-03-07T15:19:20Z</dc:date>
    </item>
  </channel>
</rss>

