- I m compiling the program statically
- No issues while running single threaded application
- Programming running correctly on base machine.
- Ubuntu 22.04.1 LTS
- PIN 3.21
- Tejas 1.4
Source code:
#include <iostream>
#include <pthread.h>
// size of array
#define MAX 1024
#define MAX_THREAD 2
using namespace std;
int a[MAX];
int sum[MAX_THREAD] = { 0 };
int part = 0;
void setArray()
{
for(int i=0;i<MAX;i++)
{
a[i]=i;
}
}
void* sum_array(void* arg)
{
int thread_part = part++;
for (int i = thread_part * (MAX / 2); i < (thread_part + 1) * (MAX / 2); i++)
sum[thread_part] += a[i];
return NULL;
}
int main()
{
setArray();
pthread_t threads[MAX_THREAD];
for (int i = 0; i < MAX_THREAD; i++)
pthread_create(&threads[i], NULL, sum_array, (void*)NULL);
for (int i = 0; i < MAX_THREAD; i++)
pthread_join(threads[i], NULL);
int total_sum = 0;
for (int i = 0; i < MAX_THREAD; i++)
total_sum += sum[i];
cout << "sum is " << total_sum << endl;
return 0;
}
Error:
-- starting java thread0
Hello from run()
[stdin] numIgn = 0
[stdin] numSim = 40000000
[stdin] id received = 54258
[stdin] pinpoints file received = nofile
[stdin] maxNumActiveThreads = 8
[stdin] start marker =
[stdin] end marker =
[stdin] outOfROIPhase = 0
[stdin] threads till now 1
num of threads on core 0 = 1
[stderr] Pin app terminated abnormally due to signal 11.
Anyone familiar with this please help me. Please feel free to seek more information.