2022-11-04 09:35:42 -07:00

32 lines
448 B
C

/*
* @@name: copyin.1
* @@type: C
* @@operation: compile
* @@expect: success
* @@version: pre_omp_3.0
*/
#include <stdlib.h>
float* work;
int size;
float tol;
#pragma omp threadprivate(work,size,tol)
void build()
{
int i;
work = (float*)malloc( sizeof(float)*size );
for( i = 0; i < size; ++i ) work[i] = tol;
}
void copyin_example( float t, int n )
{
tol = t;
size = n;
#pragma omp parallel copyin(tol,size)
{
build();
}
}