OpenMP*

Diagnostic 1392: variable "entity" in firstprivate or lastprivate clause of an OpenMP pragma must be shared in the enclosing context

Cause
One case that the Intel C++ Compiler will emitting this diagnostic message is when using the "firstprivate" of OpenMP* with a wrong syntax.

Example
t.cpp:

 

#include <stdio.h>

int main(int argc, char* argv[]) 
{
	int mysum=0;

#pragma omp for firstprivate(mysum)
	for (int i=0; i<1000; i++) {
		mysum += i; 
	}

	printf("mysum=%drn", mysum);
	return 0;
}

 

Output from build environment on Windows:

  • Linux*
  • Apple Mac OS X*
  • Microsoft Windows* (XP, Vista, 7)
  • C/C++
  • Intel® C++ Compiler
  • Intel® Parallel Composer
  • OpenMP*
  • Intel® Fortran Compiler - OpenMP* specification support

    Intel® Fortran Compiler 

    The Intel® Fortran compiler supports the OpenMP* 2.5 specification for Fortran in the 10.x compiler and OpeMP* specification 3.0 for Fortran in the 11.x compiler. For more information, see the section on Parallelization in the Optimizing Applications section of the compiler documentation.

    Operating System:

  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Apple Mac OS X*
  • Fortran
  • Intel® Fortran Compiler
  • OpenMP*
  • Intel® 20 Questions Contest: Question 12

    logo

    Intel® 20 Questions Contest: Question #12

    Intel® Parallel Composer

    Question:

    Intel® Parallel Composer: Extract project and source files from <Intel Parallel Studio directory>\Composer\Samples\en_US\C++\NQueens.zip. Study project nq-openmp-intel. What function does nq-openmp-intel use to get the OpenMP* thread number?

  • OpenMP*
  • Parallel Computing
  • Threading Fortran applications for parallel performance on multi-core systems

    Advice and background information is given on typical issues that may arise when threading an application using the Intel Fortran Compiler and other sofftware tools, whether using OpenMP, automatic parallelization or threaded libraries.
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Apple Mac OS X*
  • Fortran
  • Intel® Fortran Compiler
  • performance
  • mult-core
  • OpenMP*
  • Optimization
  • Threading
  • Pages

    Subscribe to OpenMP*