diff --git a/aidge_export_cpp/kernels/convolution.hpp b/aidge_export_cpp/kernels/convolution.hpp index 40f22c6f241b835f58f19285d518413f398ed8ff..7df55abdbfd1297ddf31c0c9bf35c7fa9f076af2 100644 --- a/aidge_export_cpp/kernels/convolution.hpp +++ b/aidge_export_cpp/kernels/convolution.hpp @@ -48,7 +48,9 @@ void convolution_forward( 0, DILATED_KERNEL_HEIGHT); const int iy = (oy * STRIDE_Y) - PADDING_Y; +#ifdef _OPENMP #pragma omp parallel for collapse(2) +#endif for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int output = 0; output < NB_OUTPUTS; ++output) { // moved to inner loop for collapsing --> @@ -200,7 +202,9 @@ void convolution_depthwise_forward( 0, DILATED_KERNEL_HEIGHT); const int iy = (oy * STRIDE_Y) - PADDING_Y; +#ifdef _OPENMP #pragma omp parallel for collapse(2) +#endif for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int output = 0; output < NB_OUTPUTS; ++output) { // moved to inner loop for collapsing --> diff --git a/aidge_export_cpp/kernels/fullyconnected.hpp b/aidge_export_cpp/kernels/fullyconnected.hpp index 2780de2deadd9c519597627e64eb5bedeee948f8..60805e7b90fa29ba00c6736bb8771985aeca19b4 100644 --- a/aidge_export_cpp/kernels/fullyconnected.hpp +++ b/aidge_export_cpp/kernels/fullyconnected.hpp @@ -28,6 +28,9 @@ void fullyconnected_forward ( // It is only an issue if the FC was after a flatten layer. // Otherwise it is not an issue for the other FC because CHANNELS_WIDTH = CHANNELS_HEIGHT = 1 // Solution: Add a system to check dataformat +#ifdef _OPENMP +#pragma omp parallel for +#endif for (int och = 0; och < NB_OUTPUTS; och++) { Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0); @@ -45,7 +48,9 @@ void fullyconnected_forward ( } /* Here the kernel to use with inputs in NHWC and weights in NHWC +#ifdef _OPENMP #pragma omp parallel for +#endif for (int och = 0; och < NB_OUTPUTS; och++) { Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0); diff --git a/aidge_export_cpp/kernels/leakyrelu.hpp b/aidge_export_cpp/kernels/leakyrelu.hpp index 07352cd2bf8d73eb1bb3afdcca381fcec4729bbd..5e6598d8fe5d43d9ae9320498289577ab7695e97 100644 --- a/aidge_export_cpp/kernels/leakyrelu.hpp +++ b/aidge_export_cpp/kernels/leakyrelu.hpp @@ -11,7 +11,9 @@ void leakyrelu_forward ( Output_T* __restrict outputs, const float negative_slope) { +#ifdef _OPENMP #pragma omp parallel for +#endif for (int i = 0; i < NB_DATA; ++i) { if (inputs[i] >= 0) { outputs[i] = inputs[i]; diff --git a/aidge_export_cpp/kernels/pooling.hpp b/aidge_export_cpp/kernels/pooling.hpp index a86fd4196a9f6e19f45dbdc4f1035c1e94e7d285..30fa766abbeded7eb55caf01902c216d95a2ed17 100644 --- a/aidge_export_cpp/kernels/pooling.hpp +++ b/aidge_export_cpp/kernels/pooling.hpp @@ -36,7 +36,9 @@ void pooling_forward( 0, POOL_HEIGHT); const int iy = (oy * STRIDE_Y) - PADDING_Y; +#ifdef _OPENMP #pragma omp parallel for collapse(2) +#endif for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int output = 0; output < NB_OUTPUTS; ++output) { // moved to inner loop for collapsing -->