Cross-thread Stack Access

Cross-thread Stack Access

I am using Intel Parallel Inspector 2011 on a Windows machine, along with the 11.1 compiler, and receive multiple warnings on stack cross access for my FORTRAN code, which I do not understand.

The FORTRAN code has multiple parallel regions, separated by serial sections. A subroutine REALLOCP is called (once during the execution) in a serial section, in which several global arrays are allocated. These arrays are used later in the progrm in parallel DO loops. The Inspector flagseachaccess to these arrays inallparallel sections with the Stack Cross Access warnings.

I am not very versed in these things, but the only explanation i could come up with was that REALLOCP is executed by a thread other than the master thread, thus palcing these arrays on its stack. To test it, i placed the call to REALLOCP inside a "!$omp master - !$omp end master" directive, and the wanrings went away.

It sounds crazy to me but is it possible that a serial section is assigned to a thread other than the master thread?


3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Yes. If you have global arrary allocated, but used by multiple threads, pass them in parameters crossed stack in thread's entry function - Inspector XE will report warning message, says Cross-thread stack access. It didn't indicate Error happened, just a warning message - if gloabl arrary will be used in multiple threads, there is *potential* risk of data races.

But you said that this is serial section with loop, than you placed directive that code worked in master thread, the warning went away. I doubt maybe compiler optimized the loop with parallelism to create other threads, so you may try to disable optimztion with "-O0" to verify again.

Thank you, Peter, i will give it a shot.

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui