inside activateNN fuction if you uncomment the #pragma omp, it runs 2 time slower on my machine, i even have tried to parallelize different more simple parts of my code but still it take more time
void activateNN(double* Vector){
int i = 0;
int y = 0;
//#pragma omp parallel for private(i)
for (i = 0; i < L1; i++) {
OL1[i] = 0;
for (y = 0; y < N; y++)
OL1[i] += WL1[i][y] * Vector[y];
OL1[i] += WL1[i][N];
OL1[i] = activation_Sigmoid(OL1[i]);
}
for (i = 0; i < L2; i++) {
OL2[i] = 0;
for (y = 0; y < L1; y++)
OL2[i] += WL2[i][y] * OL1[y];
OL2[i] += WL2[i][L1];
OL2[i] = activation_Sigmoid(OL2[i]);
}
}
question from:
https://stackoverflow.com/questions/66050836/omp-parallel-for-takes-more-time-than-serial-code 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…