Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Setting OMP_CANCELLATION to true

Jon_D
New Contributor I
1,136 Views

Hello,

How can I set the OMP_CANCELLATION environment variable to true? Within my code, I tried

    !$ OMP_CANCELLATION = .TRUE.

but the compiler says OMP_CANCELLATION variable is not defined. Other OMP directives in my code aare recognized so I think I properly activated OpenMP compilation. I am using compiler version 16.0.4.246.

Thanks,

Jon

 

 

0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,136 Views

Environment variables are set in the command shell before you run the program. I don't know if a SETENV call (USE IFPORT to declare it) will be honored in this case.

0 Kudos
Jon_D
New Contributor I
1,136 Views

Steve,

I tried setting this variable by executing

set OMP_CANCELLATION = true

command from the command prompt in which I ran my program. It didn't work, I also tried setting it through the VS IDE through Debugging -> Environment, or by calling the SETENVQQ command from IFPORT. Non of them worked.

Any suggestions how I can set this variable to true?

Thanks,

Jon

 

 

 

0 Kudos
Steven_L_Intel1
Employee
1,136 Views

I think you'll need to provide a test program that demonstrates the problem. The SET command should have set this.

0 Kudos
Jon_D
New Contributor I
1,136 Views

Steve,

I was putting together a simple program and SET command does work as well as setting the variable through the IDE Debugging-> Environment. I don't know what went wrong with my original program. SETENVQQ from IFPORT does not work though.

Is there any way to set the variable during run-time, though? I distribute my compiled executable to other parties and I would rather send them an .exe file instead of a batch file.

On another note, as I was testing my simple program I noticed that the program hangs at a simple WRITE command within the parallel region which is trying to write the loop index value to a file. I seem to remember that I used to be able to do this without any problem in the past. Is this the expected behavior or am I maybe doing something wrong? The code and the VS project file is attached.

Thanks for all your help,

Jon

 

0 Kudos
Steven_L_Intel1
Employee
1,136 Views

As I suggested above, changing this value at run-time might not work. Most of these things are looked at when the program starts up and not again later.

Try changing option Code Generation > Generate Reentrant Code to Threaded. This controls how the run-time library protects itself against reentrant calls. In version 17 Threaded is the default, but in earlier versions it isn't.

0 Kudos
Reply