<?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 Strange crashes of OMP-parallelized FFT code on Itanium in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950097#M5148</link>
    <description>A small bit of background:&lt;BR /&gt;


I'm a relative novice to OpenMP - I decided on it because my literature&lt;BR /&gt;


survey seemd to indicate that it required far less code intervention&lt;BR /&gt;


than e.g. direct Posix thread coding would (though it seems OpenMP is&lt;BR /&gt;


basically designed to be a user-friendly macro-ization of Posix threads.)&lt;BR /&gt;


&lt;BR /&gt;


I have a large-integer-arithmetic C code that I'm currently trying&lt;BR /&gt;


to parallelize. The key operation is a big-int multiply algorithm that&lt;BR /&gt;


uses a double-precision FFT to effect the multiply - we're talking&lt;BR /&gt;


about multi-megabit inputs here, i.e. FFTs on vectors consisting on&lt;BR /&gt;


the order of a million doubles. The FFT algorithm first does an initial&lt;BR /&gt;


radix-R pass through the length-N vectors of doubles (this is not yet&lt;BR /&gt;


parallelized, though eventually it will be), subsequent to which the&lt;BR /&gt;


bulk of the work can be done by operating on R independent chunks,&lt;BR /&gt;


each consisting of N/R doubles which are contiguous in memory. That&lt;BR /&gt;


chunk-processing step is contained in the following short piece of&lt;BR /&gt;


code, which I've stripped down to make it simpler to read:

&lt;PRE&gt;
  omp_set_num_threads(NTHREADS);
  #pragma omp parallel for default(shared) schedule(dynamic) nowait
  {
    for(i = 0; i &amp;lt; R; i += 2)
    {
	process_chunk(a,i, {bunch of other scalar and array arguments, all read-only});
    }
  }	/* end of #pragma omp parallel */
&lt;/PRE&gt;

Key notes about the above piece of code:&lt;BR /&gt;


&lt;BR /&gt;


    * Each of the iterations through the above loop accesses a block&lt;BR /&gt;


    of the main data array a[] that is not touched by any of the other&lt;BR /&gt;


    threads. Except for a[] and the loop index i, all other arguments&lt;BR /&gt;


    to the process_chunk function are read-only (but not explicitly&lt;BR /&gt;


    declared const, since they need to be initialized and in some&lt;BR /&gt;


    cases permuted prior to their being used in the FFT), and are&lt;BR /&gt;


    assumed shared by all threads.&lt;BR /&gt;


&lt;BR /&gt;


    * If I understand the OpenMP documentation correctly, the loop&lt;BR /&gt;


    index i is thread-private by default, and all other variables&lt;BR /&gt;


    that need to be private are buried within the mers_process_chunk()&lt;BR /&gt;


    function, so we need not explicitly declare anything private above.&lt;BR /&gt;


&lt;BR /&gt;


The code builds fine (I'm using the Intel v9 C compiler) in both single&lt;BR /&gt;


and multi-threaded mode (i.e. without and with the -openmp flag and the&lt;BR /&gt;


#defines that activates within the source). In single-threaded mode it&lt;BR /&gt;


runs just fine and has been subject to extensive testing. When built&lt;BR /&gt;


with -openmp, the compiler gives no warnings about anything related&lt;BR /&gt;


to the above loop or the OpenMP pragmas, but the resulting executable&lt;BR /&gt;


does not run reliably. Sometimes it plain crashes, other times it runs&lt;BR /&gt;


but gives incorrect outputs on known test cases, other times it works&lt;BR /&gt;


fine for a while, but then either crashes or begins outputting incorrect&lt;BR /&gt;


results. I hope to get access to the Intel Thread analysis tools sometime&lt;BR /&gt;


in the near future, but as it's a system I only have remote access to and&lt;BR /&gt;


the tools are not installed there currently, it's not guaranteed. I also&lt;BR /&gt;


have an account at the HP testdrive program and sent e-mail to the&lt;BR /&gt;


sysadmin there asking if the thread tools are installed on any 
of&lt;BR /&gt;


their systems (they are not on any of the Itanium systems, that much&lt;BR /&gt;


I know), but haven't received a reply. In the meantime I thought I'd&lt;BR /&gt;


post here and see if anyone has any ideas as to what might be causing&lt;BR /&gt;


the behavior I'm seeing.&lt;BR /&gt;


&lt;BR /&gt;


Since I don't currently have access to the thread tools, the best I've&lt;BR /&gt;


been able to do is a small amount of debugging via building with the&lt;BR /&gt;


-g flag and examination of the resulting coredump file. A sample of&lt;BR /&gt;


the built &amp;amp; test output is appended below. I'd be happy to send a&lt;BR /&gt;


zipfile containing the entire source archive to anyone who desires&lt;BR /&gt;


it - just e-mail me at ewmayer@aol.com .&lt;BR /&gt;


&lt;BR /&gt;


Thanks for any help,&lt;BR /&gt;


Ernst Mayer&lt;BR /&gt;

&lt;BR /&gt;

Here is some sample build and test output - the USE_THREADS and ERR_CHECK&lt;BR /&gt;

flags are internal to the code (i.e. they're not compiler-related):&lt;BR /&gt;


&lt;PRE&gt;
# icc -o Mlucas -g -static *.c -lm -DUSE_THREADS -openmp -DERR_CHECK

mers_mod_square.c(1417) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
mers_mod_square.c(1415) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(556) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(554) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(1549) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(1547) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.


# ./Mlucas

    Mlucas 2.8x

    http://hogranch.com//mayer/README.html#2

Itanium, compiled with Intel C compiler Version 900.
INFO: using 64-bit-double form of rounding constant
INFO: Using subroutine form of MUL_LOHI
 looking for nthreads.ini file...
 NTHREADS = 16
 looking for worktodo.ini file...
 worktodo.ini file found...checking next exponent in range...
 p = 34807387
 restart file p34807387 found...reading...
Restarting M34807387 at iteration 6000
Killed


 # idb Mlucas core.8622

Intel Debugger for Itanium -based Applications, Version 9.0-16 , Build 20051202
------------------
object file name: Mlucas
core file name: core.8622
Reading symbolic information
from /home/reixt/MLucas/Mlucas_src/Mlucas...done
Core file produced from executable Mlucas
Initial part of arglist: ./Mlucas
Thread 1 terminated at PC 0x4000000000878362 by signal ABRT
(idb) where
&amp;gt;0  0x4000000000878362 in __kill(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#1  0x4000000000869ba0 in pthread_kill(thread=163851, signo=6)  "signals.c":69
#2  0x4000000000869c20 in __pthread_raise(sig=163851) "signals.c":200
#3  0x4000000000878190 in raise(sig=163851) "../linuxthreads/sysdeps/unix/sysv/linux/raise.c":32
#4  0x4000000000878d40 in abort() "../sysdeps/generic/abort.c":117
#5  0x4000000000841ab0 in __kmp_do_abort(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#6  0x4000000000840c30 in __kmp_wait_sleep(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#7  0x40000000008430d0 in __kmp_linear_barrier_release(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#8  0x400000000084efc0 in __kmp_fork_barrier(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#9  0x400000000084f0a0 in __kmp_launch_thread(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#10 0x40000000008398d0 in __kmp_launch_worker(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#11 0x4000000000863c70 in pthread_start_thread(arg=0x2800b) "manager.c":257
#12 0x4000000000
8b10f0 in __clone2(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
getRegFromUnwindContext: Can't get Gr0 from UnwindContext, using 0
&lt;/PRE&gt;</description>
    <pubDate>Sat, 21 Jan 2006 03:04:34 GMT</pubDate>
    <dc:creator>ewmayer</dc:creator>
    <dc:date>2006-01-21T03:04:34Z</dc:date>
    <item>
      <title>Strange crashes of OMP-parallelized FFT code on Itanium</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950097#M5148</link>
      <description>A small bit of background:&lt;BR /&gt;


I'm a relative novice to OpenMP - I decided on it because my literature&lt;BR /&gt;


survey seemd to indicate that it required far less code intervention&lt;BR /&gt;


than e.g. direct Posix thread coding would (though it seems OpenMP is&lt;BR /&gt;


basically designed to be a user-friendly macro-ization of Posix threads.)&lt;BR /&gt;


&lt;BR /&gt;


I have a large-integer-arithmetic C code that I'm currently trying&lt;BR /&gt;


to parallelize. The key operation is a big-int multiply algorithm that&lt;BR /&gt;


uses a double-precision FFT to effect the multiply - we're talking&lt;BR /&gt;


about multi-megabit inputs here, i.e. FFTs on vectors consisting on&lt;BR /&gt;


the order of a million doubles. The FFT algorithm first does an initial&lt;BR /&gt;


radix-R pass through the length-N vectors of doubles (this is not yet&lt;BR /&gt;


parallelized, though eventually it will be), subsequent to which the&lt;BR /&gt;


bulk of the work can be done by operating on R independent chunks,&lt;BR /&gt;


each consisting of N/R doubles which are contiguous in memory. That&lt;BR /&gt;


chunk-processing step is contained in the following short piece of&lt;BR /&gt;


code, which I've stripped down to make it simpler to read:

&lt;PRE&gt;
  omp_set_num_threads(NTHREADS);
  #pragma omp parallel for default(shared) schedule(dynamic) nowait
  {
    for(i = 0; i &amp;lt; R; i += 2)
    {
	process_chunk(a,i, {bunch of other scalar and array arguments, all read-only});
    }
  }	/* end of #pragma omp parallel */
&lt;/PRE&gt;

Key notes about the above piece of code:&lt;BR /&gt;


&lt;BR /&gt;


    * Each of the iterations through the above loop accesses a block&lt;BR /&gt;


    of the main data array a[] that is not touched by any of the other&lt;BR /&gt;


    threads. Except for a[] and the loop index i, all other arguments&lt;BR /&gt;


    to the process_chunk function are read-only (but not explicitly&lt;BR /&gt;


    declared const, since they need to be initialized and in some&lt;BR /&gt;


    cases permuted prior to their being used in the FFT), and are&lt;BR /&gt;


    assumed shared by all threads.&lt;BR /&gt;


&lt;BR /&gt;


    * If I understand the OpenMP documentation correctly, the loop&lt;BR /&gt;


    index i is thread-private by default, and all other variables&lt;BR /&gt;


    that need to be private are buried within the mers_process_chunk()&lt;BR /&gt;


    function, so we need not explicitly declare anything private above.&lt;BR /&gt;


&lt;BR /&gt;


The code builds fine (I'm using the Intel v9 C compiler) in both single&lt;BR /&gt;


and multi-threaded mode (i.e. without and with the -openmp flag and the&lt;BR /&gt;


#defines that activates within the source). In single-threaded mode it&lt;BR /&gt;


runs just fine and has been subject to extensive testing. When built&lt;BR /&gt;


with -openmp, the compiler gives no warnings about anything related&lt;BR /&gt;


to the above loop or the OpenMP pragmas, but the resulting executable&lt;BR /&gt;


does not run reliably. Sometimes it plain crashes, other times it runs&lt;BR /&gt;


but gives incorrect outputs on known test cases, other times it works&lt;BR /&gt;


fine for a while, but then either crashes or begins outputting incorrect&lt;BR /&gt;


results. I hope to get access to the Intel Thread analysis tools sometime&lt;BR /&gt;


in the near future, but as it's a system I only have remote access to and&lt;BR /&gt;


the tools are not installed there currently, it's not guaranteed. I also&lt;BR /&gt;


have an account at the HP testdrive program and sent e-mail to the&lt;BR /&gt;


sysadmin there asking if the thread tools are installed on any 
of&lt;BR /&gt;


their systems (they are not on any of the Itanium systems, that much&lt;BR /&gt;


I know), but haven't received a reply. In the meantime I thought I'd&lt;BR /&gt;


post here and see if anyone has any ideas as to what might be causing&lt;BR /&gt;


the behavior I'm seeing.&lt;BR /&gt;


&lt;BR /&gt;


Since I don't currently have access to the thread tools, the best I've&lt;BR /&gt;


been able to do is a small amount of debugging via building with the&lt;BR /&gt;


-g flag and examination of the resulting coredump file. A sample of&lt;BR /&gt;


the built &amp;amp; test output is appended below. I'd be happy to send a&lt;BR /&gt;


zipfile containing the entire source archive to anyone who desires&lt;BR /&gt;


it - just e-mail me at ewmayer@aol.com .&lt;BR /&gt;


&lt;BR /&gt;


Thanks for any help,&lt;BR /&gt;


Ernst Mayer&lt;BR /&gt;

&lt;BR /&gt;

Here is some sample build and test output - the USE_THREADS and ERR_CHECK&lt;BR /&gt;

flags are internal to the code (i.e. they're not compiler-related):&lt;BR /&gt;


&lt;PRE&gt;
# icc -o Mlucas -g -static *.c -lm -DUSE_THREADS -openmp -DERR_CHECK

mers_mod_square.c(1417) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
mers_mod_square.c(1415) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(556) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(554) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(1549) : (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
radix16_ditN_cy_dif1.c(1547) : (col. 3) remark: OpenMP DEFINED REGION WAS PARALLELIZED.


# ./Mlucas

    Mlucas 2.8x

    http://hogranch.com//mayer/README.html#2

Itanium, compiled with Intel C compiler Version 900.
INFO: using 64-bit-double form of rounding constant
INFO: Using subroutine form of MUL_LOHI
 looking for nthreads.ini file...
 NTHREADS = 16
 looking for worktodo.ini file...
 worktodo.ini file found...checking next exponent in range...
 p = 34807387
 restart file p34807387 found...reading...
Restarting M34807387 at iteration 6000
Killed


 # idb Mlucas core.8622

Intel Debugger for Itanium -based Applications, Version 9.0-16 , Build 20051202
------------------
object file name: Mlucas
core file name: core.8622
Reading symbolic information
from /home/reixt/MLucas/Mlucas_src/Mlucas...done
Core file produced from executable Mlucas
Initial part of arglist: ./Mlucas
Thread 1 terminated at PC 0x4000000000878362 by signal ABRT
(idb) where
&amp;gt;0  0x4000000000878362 in __kill(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#1  0x4000000000869ba0 in pthread_kill(thread=163851, signo=6)  "signals.c":69
#2  0x4000000000869c20 in __pthread_raise(sig=163851) "signals.c":200
#3  0x4000000000878190 in raise(sig=163851) "../linuxthreads/sysdeps/unix/sysv/linux/raise.c":32
#4  0x4000000000878d40 in abort() "../sysdeps/generic/abort.c":117
#5  0x4000000000841ab0 in __kmp_do_abort(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#6  0x4000000000840c30 in __kmp_wait_sleep(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#7  0x40000000008430d0 in __kmp_linear_barrier_release(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#8  0x400000000084efc0 in __kmp_fork_barrier(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#9  0x400000000084f0a0 in __kmp_launch_thread(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#10 0x40000000008398d0 in __kmp_launch_worker(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
#11 0x4000000000863c70 in pthread_start_thread(arg=0x2800b) "manager.c":257
#12 0x4000000000
8b10f0 in __clone2(...) in /home/reixt/MLucas/Mlucas_src/Mlucas
getRegFromUnwindContext: Can't get Gr0 from UnwindContext, using 0
&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 Jan 2006 03:04:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950097#M5148</guid>
      <dc:creator>ewmayer</dc:creator>
      <dc:date>2006-01-21T03:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Strange crashes of OMP-parallelized FFT code on Itanium</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950098#M5149</link>
      <description>It looks like you have an out-dated version of the compiler.&lt;BR /&gt;Even if you have a reason for dynamic scheduling, you should try static for comparison.&lt;BR /&gt;You are correct, Intel Thread checker is intended to diagnose any source code related problems in parallelization, more &lt;BR /&gt;efficiently than most of us could do otherwise.</description>
      <pubDate>Sat, 21 Jan 2006 05:40:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950098#M5149</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2006-01-21T05:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Strange crashes of OMP-parallelized FFT code on Itanium</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950099#M5150</link>
      <description>'icc -v' on the system I'm giving indicates version 9.0 of the compiler -&lt;BR /&gt;I was under the impression that was pretty up-to-date as far as support for OpenMP&lt;BR /&gt;is concerned.&lt;BR /&gt;&lt;BR /&gt;Using static rather than dynamic in the parallel for loop still&lt;BR /&gt;gives a crash during self-tests, but the idb diagnosis has changed:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;Intel Debugger for Itanium -based Applications, Version 9.0-14, Build 20051007&lt;BR /&gt;------------------&lt;BR /&gt;object file name: Mlucas&lt;BR /&gt;core file name: core.17232&lt;BR /&gt;eidb(17237): unaligned access to 0x200000000486040c, ip=0x4000000001ce3f31&lt;BR /&gt;eidb(17237): unaligned access to 0x2000000004860414, ip=0x4000000001ce3f31&lt;BR /&gt;eidb(17237): unaligned access to 0x200000000486041c, ip=0x4000000001ce3f31&lt;BR /&gt;eidb(17237): unaligned access to 0x2000000004860424, ip=0x4000000001ce3f31&lt;BR /&gt;Reading symbolic information from /house/ewm/src/C/IA64_LINUX/Mlucas...done&lt;BR /&gt;Core file produced from executable Mlucas&lt;BR /&gt;Initial part of arglist: Mlucas -s m&lt;BR /&gt;Thread 1 terminated at PC 0x4000000000251f02 by signal ABRT&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Message Edited by ewmayer on &lt;SPAN class="date_text"&gt;01-20-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;03:48 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2006 07:46:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950099#M5150</guid>
      <dc:creator>ewmayer</dc:creator>
      <dc:date>2006-01-21T07:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Strange crashes of OMP-parallelized FFT code on Itanium</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950100#M5151</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hello Ernst,&lt;/P&gt;
&lt;P&gt;Please try removing the braces around the loop that you want to parallelize, i.e.:&lt;/P&gt;&lt;PRE&gt;   #pragma omp parallel for default(shared) schedule(dynamic)
    for(i = 0; i &amp;lt; R; i += 2)
    {
	process_chunk(a,i, {bunch of other scalar and array arguments, all read-only});
    }
&lt;/PRE&gt;
&lt;P&gt;The braces are unnecessary and could be confusing the compiler. The nowait keyword is also meaningless in this context because you cannot remove the implied barrier on an OpenMP parallel region. The nowait keyword only removes implied barriers on OpenMP worksharing constructs. I also agree with Tim that you should try analyzing your code using Intel Thread Checker. If a race condition is causing the crash, Thread Checker should help you debug it.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Henry&lt;/P&gt;&lt;P&gt;Message Edited by hagabb on &lt;SPAN class="date_text"&gt;01-26-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;04:33 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2006 23:29:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Strange-crashes-of-OMP-parallelized-FFT-code-on-Itanium/m-p/950100#M5151</guid>
      <dc:creator>Henry_G_Intel</dc:creator>
      <dc:date>2006-01-26T23:29:03Z</dc:date>
    </item>
  </channel>
</rss>

