6,707 questions
1
vote
1
answer
53
views
OpenMP thread affinity not working in Rcpp package: "Affinity not supported on this configuration"
I'm developing an R package using Rcpp with OpenMP for parallelization. I'm facing an issue where threads are randomly spread across CPU cores, leading often to threads beeing scheduled primarily on ...
1
vote
1
answer
65
views
OpenMP directive in constexpr functions
According to OpenMP specification (2.1. Directive Format)
Directives may not appear in constexpr functions or in constant expressions. Variadic parameter packs cannot be expanded into a directive or ...
0
votes
0
answers
45
views
Does "pragma omp parallel for" only allow specific syntax in for loops? [duplicate]
In gcc (GCC) 14.2.0 the following program
int main(int argc, char *argv[]) {
#pragma omp parallel for
for (int i{0}; i < 1; ++i) {
}
return 0;
}
does compile with g++ main.cpp (without ...
1
vote
0
answers
35
views
Setting the stack size for nested parallel regions with Open MP (Fortran)
I'm using Open MP with Fortran 08 (compiled with GFortran) to create nested parallel regions (in my case, a 3-level nest). Before running my executable, I set some Linux environment variables to ...
1
vote
0
answers
60
views
Variable declaration in fortran : Pros and Cons between declaration in a block construct or copy in a private OMP Parallel clause?
I wrote these two programs to test OMP PARALLEL:
1 : my_idx is declared at the beginning of the program and after a private copy for eah thread is done.
program my_pgm
use omp_lib
implicit ...
0
votes
0
answers
39
views
Problem with construction BLOCK and openmp in gfortran
I wrote the following program :
program my_pgm
use omp_lib
implicit none
CALL OMP_set_dynamic(.FALSE.)
CALL OMP_set_num_threads(2)
!$OMP PARALLEL DEFAULT(SHARED)
...
1
vote
1
answer
82
views
Why do OpenMP programs run faster on a single process than on multiple processes?
The task was to implement various matrix multiplication algorithms using OpenMP. It turned out that with num_threads(1), the program runs faster than with any other number of threads. Is this due to ...
2
votes
2
answers
78
views
Standard way of calling math functions in C when using OpenMP & its offloading feature(s)?
I am writing some code in C in which I want to add the optional ability to have certain sections of the code accelerated using OpenMP, and with an additional optional ability to have them accelerated ...
4
votes
4
answers
283
views
Optimize a separable convolution for SIMD friendly and efficiency
I implemented a simple 2d separable convolution code:
void SeparableConvolution2D(const float * restrict mI, float * restrict mO, float * restrict mB, int numRows, int numCols, const float * restrict ...
0
votes
1
answer
83
views
Getting multiple outputs on Open MPI C++ Code
The following code gives multiple outputs
Sum of first 100000 natural numbers: 5000050000
Sum of first 100000 natural numbers: 5000050000
Sum of first 100000 natural numbers: 5000050000
Sum of ...
2
votes
1
answer
89
views
How to declare an OpenMP reduction for a std::vector inside a struct?
I'm trying to perform an std::vector sum reduction with an OpenMP reduction declaration for it:
// g++ -fopenmp MRE.cpp -o MRE
#include <vector>
#include <algorithm>
#include <omp.h>
...
0
votes
1
answer
45
views
Openmp lastprivate confusing result
I am getting following results roughly 20% of the execution with the given code and lastprivate clause is not working as expected. Pls note that end value of b should be 50 however at times it is not ...
1
vote
0
answers
68
views
loop parallelization with omp
Good morning, I was trying to parallelize a loop with OMP in a program I created for a flood simulator with the goal of achieving a performance boost. The loop I want to parallelize is as follows:
#...
1
vote
3
answers
123
views
Parallel loop in Fortran using OpenMP
I'm exploring OpenMP in Fortran, using the Mandelbrot algorithm as an example:
!$omp parallel do reduction(+:iters)
do iy=0,30
do ix=0,70
c = cmplx(xmin+stepx*ix, ymin+stepy*iy, qp)
...
0
votes
1
answer
75
views
File writing while compiling with flag -fopenmp
I'm trying to write to file a certain value, calculated with some parallelized operations using Eigen, in particular with the flag -fopenmp.
I've written a code that works perfectly with -g -o, but I'...