Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Need Help with Pointer to One-Dimensional Array in SMP Processing Application

$
0
0

Hello.  I am in need of some technical guidance regarding appropriate OpenMP directives for an SMP application.  I am currently working with a commercial finite element software to develop a user-defined material model.  Thus, I am given a collection of SMP object files.  I input my code into a specific subroutine and build an executable with the rest of the provided object files.  I'm just mentioning this to provide some background and to let you know that I don't have access to all of the source code.  During a finite element analysis, the material subroutine gets called many times.  Within the subroutine that I'm working on, I declare a pointer to a one-dimensional array that is given the SAVE attribute.  The objective of this one-dimensional array is to collect data during each call to the subroutine and, at a certain point in the analysis, I want to operate on the array.  This is why I don't want the array to go out of scope once the subroutine returns.  When I build the executable and run a finite element simulation with a single CPU the user-defined subroutine works great.  However, when I try running the same simulation using multiple CPUs in SMP format my SAVED pointer gets garbled up.  I've confirmed this via various WRITE statements throughout the subroutine.  This makes me think that perhaps the array is getting broken up in memory due to the SMP processing.  I've been reading about the THREADPRIVATE compiler directive.  I tried declaring the pointer to the one-dimensional array as THREADPRIVATE, but the values in the array still get garbled up during a multi-CPU SMP simulation.  Are there other compiler directives or anything else specific I need to be doing to ensure that my one-dimensional array remains in tact and meaningful during SMP processing?

Thank you in advance for your help!


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>