hey i have also same problem with thread ID

i am not able to get thread ID can i any one can guide?

here is my code and compile information though it gives CPU number but i 
donot get thread id. i tried ExecThread and Thread in --debug-flags

using x86

If any one can help


/*
Compile:        g++ -g -O3 -fopenmp -c -o test_omp.o arraySummation_omp.cpp
Link:           g++ -static -o test_omp test_omp.o -lgomp /opt/m5threads-
1118adb7cdad_X86/pthread.o -lgomp
Run:            gem5x86.opt --debug-flags=Exec,ExecTicks 
/home/akt0001/GEM5/configs/example/se.py -n 4 -c test_omp --options="
<num_threads> <size_of_array>"
*/

#include <iostream>
#include <cstdlib>
#include <omp.h>
#include <pthread.h>

using namespace std;


int main(int argc, const char **argv)
{
        if (argc != 3){
                cout << "Usage: ./arraySummation_omp <nthreads> <size>" << 
endl;
        }
        int nthreads = atoi(argv[1]);
        
        if (nthreads < 1){
        cout << "nthreads must be 1 or more" << endl;
        }
        
        int size = atoi(argv[2]);
        if (size < 1){
        cout << "size must be more than 1" << endl;
        }
        
        cout << "size" << size << endl;
        omp_set_num_threads(nthreads);
        
        float a[size], b[size], c[size];
        float temp = 0;
        
        for (int i = 0; i< size; i++){
                a[i] = 1;
                b[i] = 2;
            c[i] = 0;
                }
        
        #pragma omp parallel for
                for (int i = 0; i< size; i++){
            c[i] = a[i] + b[i];
                }
                
        for (int i = 0; i < size; i++) temp = c[i] + temp;      
        cout << "Addition of two array is " << temp << endl;
}














_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to