c - How to save wtime differences in a File from multiple thread in OpenMP? -


i trying use openmp database internal project improve performance. need running time(am using omp_get_wtime()) saved in file there no way can print console program. please suggest if better way exists. tried write single file threads(see below code), crashing when number of threads more one. please help. in advance.

  file *fp = null;   fp = fopen("/home/fopen.txt","a");   ...   omp_set_num_threads(2);   fprintf(fp,"num of threads: %d\n",omp_get_num_threads());   #pragma omp parallel default(shared) private(tid)   {       tid = omp_get_thread_num();        #pragma omp critical       fprintf(fp,"threadid of thread %d\n",tid);       :       :   }   if (fp != null)   fclose(fp); 

needed set array recording times, had each thread write element of array (indexed thread number). after parallel region had remaining active thread write array file. @high performance mark.


Comments

Popular posts from this blog

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

python - How to use Celery in Tornado with redis as broker and backend? -