"Illegal instruction" error with OpenMP

"Illegal instruction" error with OpenMP

I am having a rather peculiar error when trying to use OpenMP and ifort in OS X.I have the following [very simple] code:!========================================program axpyimplicit noneinteger, parameter :: n=10000000integer :: idouble precision :: a, stime, ftimedouble precision, dimension(n) :: x, y, za = -3.d0do i=1,n x(i) = exp(2.d0*i/n) y(i) = 1.d0*(n-1)/nend dodo i=1,n z(i) = a*x(i) + y(i)end dodo i=1,n x(i) = y(i)/a - z(i)end dodo i=1,n y(i) = x(i)*y(i)/nend dowrite(*,*) ' max(z) =',maxval(z)end program axpy!========================================The code is in a file "axpy_omp.f90"I compile this at the command line with ifort -openmp -O2 axpy_omp.f90 -o axpy_omp.exeand when I run the code I get the error message Illegal instructionIf I compile without OpenMP, ifort -O2 axpy_omp.f90 -o axpy_omp.exeit runs just fine.I have seen some other threads complaining about ifort + XCode, though since I'm not using XCode in this process, I'm not sure if it is at all related. In any case, I'm running on OS X 10.5.8, with XCode 3.1.4 installed. My version of ifort isifort (IFORT) 11.0 20090318Any help would be appreciated, as I'm planning on using this code as a simple OpenMP example in an upcoming class.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

you're being slapped by the puny stack size on Mac OS X.

read this article: http://software.intel.com/en-us/articles/determining-root-cause-of-sigse...

but since you're using OMP, you can't use -heap-arrays. The ulimit -s 65532 isn't going to help either, as this is still too small. Use the -Wl trick. This worked for me:

ifort -openmp -O2 -o u80188 u80188.f90 -Wl,-stack_size,0x10000000

and it ran
$ ./u80188
max(z) = -2.00000070000006

Now the caveat: I did this with the latest compiler and not 11.0. But your code is so simple, I don't see anything that would trip up the 11.0 compiler.

Good luck with the class!


Thanks for the quick reply. I hadn't thought of the stack size, though I should have. I also have corresponding C routines for all of my F90 examples, and had no trouble in the equivalent C file, though there I dynamically allocate the arrays. Instead of using your workaround I just allocated the arrays at runtime instead of declaring them statically in the header.

Leave a Comment

Please sign in to add a comment. Not a member? Join today