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

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -