initial check in
This commit is contained in:
66
openMP_simple_test.cpp
Normal file
66
openMP_simple_test.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// toIntTest.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include <omp.h>
|
||||
#include <stdio.h>
|
||||
#include "getCurrentTime.h"
|
||||
|
||||
#include "../fw/2007.12/src/base/point.h"
|
||||
|
||||
#if !defined(__AIX) && !defined(__sparc)
|
||||
#define LOW_ENDIAN_ARCH
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define MY_INLINE __forceinline
|
||||
#else
|
||||
#define MY_INLINE inline
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define __int64 long
|
||||
#endif
|
||||
|
||||
|
||||
void test1()
|
||||
{
|
||||
int th_id, nthreads;
|
||||
#pragma omp parallel private(th_id)
|
||||
{
|
||||
th_id = omp_get_thread_num();
|
||||
printf("Hello World from thread %d\n", th_id);
|
||||
#pragma omp barrier
|
||||
if ( th_id == 0 )
|
||||
{
|
||||
nthreads = omp_get_num_threads();
|
||||
printf("There are %d threads\n",nthreads);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test2()
|
||||
{
|
||||
int th_id, nthreads;
|
||||
#pragma omp parallel private(th_id)
|
||||
{
|
||||
th_id = omp_get_thread_num();
|
||||
printf("Hello World from thread %d\n", th_id);
|
||||
// #pragma omp barrier
|
||||
if ( th_id == 0 )
|
||||
{
|
||||
nthreads = omp_get_num_threads();
|
||||
printf("There are %d threads\n",nthreads);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Init
|
||||
initGetCurrentTimeLib();
|
||||
|
||||
// test1();
|
||||
test2();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user