openMP side effects

openMP side effects

Аватар пользователя theoryx

I have a piece of the following code in the my fortran program.

!$OMP PARALLEL
!$OMP END PARALLEL

abc(1,1,1) = 1.0

Depending on where I put the dimension of a in the variable definition area, 'a' has undefined address values and the assignment does not occur. If I remove the OMP commands everything works.

Note: This include me putting more codein the OMP Parallel region.

4 posts / 0 новое
Последнее сообщение
Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.
Аватар пользователя Tim Prince

If you're asking about how compiling with OpenMP option affects other compilation details, you would need to specify which compiler you mean. You would probably need to post an actual example, preferably using a support forum specific to the compiler you have in mind.

Аватар пользователя theoryx

I am using Fortran Composer XE 2011 and I am using Visual Studio 2008 as the shell.

Here is the simplest code that I wrote that would not work:

=============================

PROGRAM Console3

IMPLICIT NONE

INTEGER, PARAMETER :: a1 = 30
INTEGER, PARAMETER :: a2 = 100
INTEGER, PARAMETER :: a3 = 100

REAL, DIMENSION(a1,a2,a3) :: abc

!$OMP PARALLEL
!$OMP END PARALLEL

abc(1,1,1) = 1.0

end program Console3

=============================

The assignment of abc(1,1,1) does not occur. Two ways I can "fix" this code is one to remove the OMP commands and second to make the array 2D. Can you help? Or guide me as to where to look or what other forum to post in?

Аватар пользователя Raghu Reddy

Not sure what you mean by saying "assignment does not occur". How do you know? Since you're not printing that value you don't know if it worked or not. In fact if the code is compiled with optimization the assignment may even be skipped as redundant code.
By the way, I mostly work on linux machines, so not sure if the following suggestion is helpful.
I have had problems with small codes (with simple openmp directives) like this before that I thought should have worked but didn't, and generally setting the stack size to something large solved the problem.
You may have to set the stack size for the shell to something large, and also set OMP_STACKSIZE to something large.

Зарегистрируйтесь, чтобы оставить комментарий.