Skip to content
Snippets Groups Projects
Commit e37444e7 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Added _OPENMP guards

parent 9c03c1f6
No related branches found
No related tags found
2 merge requests!490.3.1,!40Add ConvDepthWise support
Pipeline #71608 failed
...@@ -48,7 +48,9 @@ void convolution_forward( ...@@ -48,7 +48,9 @@ void convolution_forward(
0, DILATED_KERNEL_HEIGHT); 0, DILATED_KERNEL_HEIGHT);
const int iy = (oy * STRIDE_Y) - PADDING_Y; const int iy = (oy * STRIDE_Y) - PADDING_Y;
#ifdef _OPENMP
#pragma omp parallel for collapse(2) #pragma omp parallel for collapse(2)
#endif
for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) {
for (int output = 0; output < NB_OUTPUTS; ++output) { for (int output = 0; output < NB_OUTPUTS; ++output) {
// moved to inner loop for collapsing --> // moved to inner loop for collapsing -->
...@@ -200,7 +202,9 @@ void convolution_depthwise_forward( ...@@ -200,7 +202,9 @@ void convolution_depthwise_forward(
0, DILATED_KERNEL_HEIGHT); 0, DILATED_KERNEL_HEIGHT);
const int iy = (oy * STRIDE_Y) - PADDING_Y; const int iy = (oy * STRIDE_Y) - PADDING_Y;
#ifdef _OPENMP
#pragma omp parallel for collapse(2) #pragma omp parallel for collapse(2)
#endif
for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) {
for (int output = 0; output < NB_OUTPUTS; ++output) { for (int output = 0; output < NB_OUTPUTS; ++output) {
// moved to inner loop for collapsing --> // moved to inner loop for collapsing -->
......
...@@ -28,6 +28,9 @@ void fullyconnected_forward ( ...@@ -28,6 +28,9 @@ void fullyconnected_forward (
// It is only an issue if the FC was after a flatten layer. // 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 // Otherwise it is not an issue for the other FC because CHANNELS_WIDTH = CHANNELS_HEIGHT = 1
// Solution: Add a system to check dataformat // Solution: Add a system to check dataformat
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int och = 0; och < NB_OUTPUTS; och++) { for (int och = 0; och < NB_OUTPUTS; och++) {
Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0); Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0);
...@@ -45,7 +48,9 @@ void fullyconnected_forward ( ...@@ -45,7 +48,9 @@ void fullyconnected_forward (
} }
/* /*
Here the kernel to use with inputs in NHWC and weights in NHWC Here the kernel to use with inputs in NHWC and weights in NHWC
#ifdef _OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif
for (int och = 0; och < NB_OUTPUTS; och++) { for (int och = 0; och < NB_OUTPUTS; och++) {
Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0); Bias_T weightedSum = (biases) ? biases[och] : Bias_T(0);
......
...@@ -11,7 +11,9 @@ void leakyrelu_forward ( ...@@ -11,7 +11,9 @@ void leakyrelu_forward (
Output_T* __restrict outputs, Output_T* __restrict outputs,
const float negative_slope) const float negative_slope)
{ {
#ifdef _OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif
for (int i = 0; i < NB_DATA; ++i) { for (int i = 0; i < NB_DATA; ++i) {
if (inputs[i] >= 0) { if (inputs[i] >= 0) {
outputs[i] = inputs[i]; outputs[i] = inputs[i];
......
...@@ -36,7 +36,9 @@ void pooling_forward( ...@@ -36,7 +36,9 @@ void pooling_forward(
0, POOL_HEIGHT); 0, POOL_HEIGHT);
const int iy = (oy * STRIDE_Y) - PADDING_Y; const int iy = (oy * STRIDE_Y) - PADDING_Y;
#ifdef _OPENMP
#pragma omp parallel for collapse(2) #pragma omp parallel for collapse(2)
#endif
for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) { for (int ox = 0; ox < OUTPUTS_WIDTH; ++ox) {
for (int output = 0; output < NB_OUTPUTS; ++output) { for (int output = 0; output < NB_OUTPUTS; ++output) {
// moved to inner loop for collapsing --> // moved to inner loop for collapsing -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment