Questions tagged [openmp]
OpenMP is a cross-platform multi-threading API which allows fine-grained task parallelization and synchronization using special compiler directives.
6,123
questions
0
votes
1
answer
46
views
Is it normal for parallel algoritm to be slower than sequential one?
So I have a task to compare sequential and parallel version of the code.
#sequential
for (int k = 0; k < ROWS; k++) {
for (int i = 0; i < COLUMNS; i++) {
for (int j = 0; j &...
2
votes
0
answers
42
views
How to correctly use the update() clause in OpenMP
I have a program that was originally being executed sequentially and now I'm trying to parallelize it via OpenMP Offloading. The thing is that when I use the update clause, depending on the case, if I ...
0
votes
0
answers
34
views
splicing a list declared inside an omp_parallel block to a list declared outside the block in openmp C++
I'm wondering what happens when one splices a (C++) list declared inside an omp_parallel block to a list declared outside the block. An example would be the following :
list<object> l;
#pragma ...
0
votes
1
answer
44
views
OpenMP Do I have race condition or false-sharing '?
I'm trying to write a code for matrix multiplication. As far as I understand OMP and pararel programming this code may suffer from race condition.
#pragma omp parallel
#pragma omp for
for (int k = ...
-1
votes
0
answers
88
views
Trying to parallelize deeply nested for-loops with OpenMP
I'm trying to parallelize the following code. Here is the main idea:
Given a Boolean function, I want to know if there is a combination that can satisfy the Boolean function given some constrains (...
0
votes
0
answers
37
views
Enforcing progress thread when overlapping communication and computation
This question is originating from here: Overlapping communication and computation taking 2.1 times as much time.
I've implemented Cannon's algorithm which performs distributed memory tensor-matrix ...
1
vote
1
answer
53
views
How to fully parallelise sequential inner loops in Fortran with OpenMP
I'm attempting to parallelise some old fixed format Fortran code with OpenMP. I can't figure out how to fully parallelise the following structure of nested loops, with one outer loop and 2 sequential ...
3
votes
1
answer
40
views
MSVC Error C3015 (bad OpenMP for loop) but not an obvious mistake
I'm compiling some C++ code in Visual Studio 2022. I'm using /std:c++17 /O2 /permissive- /openmp:llvm /MP /arch:AVX2 as compiler settings. I'm getting the compiler error
C3015 initialization in ...
1
vote
0
answers
29
views
OpenMP GPU offload; Map scalar
I am trying to understand/test OpenMP with GPU offload. However, I am confused because some examples/info (1, 2, 3) in the internet are analogous or similar to mine but my example does not work as I ...
1
vote
1
answer
50
views
When will omp thread pool get destructed
I use openomp in my service for parallelizing my loop. But every time when a request came in, my service will create a brand new thread for it, and this thread will use omp to create a thread pool. ...
0
votes
2
answers
64
views
omp_set_nested routine deprecated, please use omp_set_max_active_levels instead
I started getting the following warning repeatedly when running my PyTorch Lightning deep learning scripts, at execution start and then all through the training:
"OMP: Info #276: omp_set_nested ...
0
votes
0
answers
57
views
Why is omp critical needed here?
void main()
{
int i, n;
double A[N], B[N];
printf(“Give threads number\n”);
scanf(“% d”, &n);
omp_set_num_threads(n);
/*Assume that array A is initialized here*/
for (i ...
1
vote
1
answer
51
views
OpenMP integer copied after tasks finish
I do not know if this is documented anywhere, if so I would love a reference to it, however I have found some unexpected behaviour when using OpenMP. I have a simple program below to illustrate the ...
-1
votes
0
answers
38
views
OMP Nest loops, intel segmentation fault always
I am doing CSR matrix-vector multiplication using OMP as follows, however using intel impi sementation fault always occurs. I have no idea where the wrong is? I assigned q0 to each thread, still not ...
0
votes
0
answers
62
views
Parallelisation of the Nested Loop
My code is composed of two files. The main file, which has the loop over variable 'i' from 1 to 'kb(1)*kb(2)*kb(3)' and I used MPI to parallelise this loop. The main code is written below and the ...
0
votes
1
answer
59
views
Cannot run more than 1 thread in parallel using OpenMP in Windows 11, VIsual Studio 2019
I created an empty C++ project using Visual Studio 2019 in Windows 11.
Then I ran this minimal piece of code to test multi-threading, using OpenMP:
#include <iostream>
#include <omp.h>
...
1
vote
1
answer
81
views
Call Fortran subroutine in a OpenMP parallel region?
I am trying to call a subroutine inside the main OpenMP parallel region like:
type(type1) :: A(:)
!$omp parallel private(variable_a, variable_b, ...)
!$do
do i = 1, n, 1
call A(i) % sub(variable_a, ...
1
vote
1
answer
60
views
How can I edit device variables in OpenMP?
The problem is quite simple: I'm trying to edit the value of a variable inside a target data region in OpenMP, but whatever I do, I'm editing the host variable, not the one in the device's memory.
...
0
votes
2
answers
41
views
oneMKL can not offload by openmp
I tried to run the official code in OneAPI example and found that the following code is not actually running on the GPU.
#pragma omp target data map(to:a[0:sizea],b[0:sizeb]) map(tofrom:c[0:sizec]) ...
0
votes
3
answers
60
views
OpenMP paralellized C++ code exhibits higher execution times on more threads?
I'm trying to learn paralellization of C++ using openmp, and I'm trying to use the following example. But for some reason when I increase the number of threads the code runs slower. Im compiling it ...
0
votes
0
answers
36
views
performance issue between different versions of openmp / gcc compilers
I have some performance issue between different versions of openmp / gcc compilers.
For some reason I encounter some load performance issue while running on M5 Redhat 8.5 Operating System.
I used to ...
0
votes
1
answer
57
views
Link MKL statically in MPI program
I have a Fortran MPI program that uses openMP and MKL. On my personal computer I would compile with the Intel compiler by calling something like mpiifort Program.F90 -i8 -qmkl -fopenmp -o run, and ...
-1
votes
1
answer
69
views
how to optimize this eigen library code via openMP or by any other means
I wanted to parallelize and optimize my code which uses eigen library but i am struck due to this situation
A part of code which take 2-3 secs.in one iterations is repeatedly runs many times due to a ...
0
votes
0
answers
37
views
OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized [duplicate]
I have already followed
OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized
How can I fix an "OMP: Error #15: Initializing libiomp5.dylib, but found libomp....
0
votes
0
answers
45
views
performance drop of omp threaded function when used in larger program
consider the following C++ pseudo-code
void x1(){
#pragma omp parallel for
for(int i=0;i<n;++i{
//do someting
}
}
void x2(){
#pragma omp parallel for
for(int i=0;i<n;++i{
//do ...
1
vote
1
answer
33
views
How OpenMP macros work behind the scenes in collaboration with the preprocessor/compiler and the library itself?
I'm trying to implement a similar functionality to one of my projects and I was wondering how it works.
For example, I was wondering how #pragma omp parallel default(shared) private(iam, np) works in ...
0
votes
1
answer
78
views
Data race in parallelized nested loop
I have a triple nested loop that I would like to parallelize, however, I am getting a data race issue. I am pretty sure that I need to use a reduction somehow, but I don't quite know how.
This is the ...
0
votes
1
answer
73
views
Usage of all available threads for OMP inside Master MPI only part - hybrid parallel programming
Is it possible to use all available threads for OMP on a region where only master MPI is active?. I mean something like this:
START
|
MPI-I --------- MPI-II
(master)
| ...
0
votes
0
answers
27
views
pybind11 combined with openMP slows code outside of the parallel section
I am observing a slowdown on my serial code following and openMP section when calling it from python using pybind11.
Here is the smallest reproducible example I could do. Bellow are two version of a ...
0
votes
1
answer
65
views
allocate and free array in parallel loop with openmp in c
i have parallel loop which i allocate memory as an array and free that array at the end.
the problem is, when i want to free that, because of parallelism its not clear that i should free which array, ...
2
votes
1
answer
117
views
OpenMP basic temperature modelling with parallel processing taking longer than serial code
I am new to OpenMP and I have to complete this project where I need to resolve a 2D matrix using Jacobi iteration method to resolve a heat conductivity problem using OpenMP.
Essentially It is a plate ...
1
vote
1
answer
60
views
-lomp not found for openmp apple m1
I am currently trying to compile a cpp program with openmp. From what I have read online this is the command that I need to use for indeed using openmp on apple silicon:
g++ -Xpreprocessor -fopenmp -...
3
votes
1
answer
66
views
Scan for quicksort splitting
I'm trying to write quicksort with OpenMP, and I'm getting stuck in the splitting part. The literature says that this is a parallel prefix operation. Here's the relevant bit:
vector<int> ...
0
votes
1
answer
49
views
Segmentation Faults with OPEN MP and pointer operations
I'm developing a code to simulate the response of some dynamical systems to my PhD research. To this end, I'm trying to implement parallelization with OpenMP to increase the performance of the code.
...
0
votes
0
answers
44
views
Setting up NVIDIA SDK on VSCode with CMake CMake-tools and OpenMP
I am trying to set up debugging with VScode for nvc++ on Ubuntu 20.04
I am using CMake to build my program that is using openmp and have cmake-tools as vscode extensions.
My c++ project is well setup ...
0
votes
2
answers
53
views
Using consistent RNG with OpenMP
So I have a function, let's call it dostuff() in which it's beneficial for my application to sometimes parallelize within, or to do it multiple times and parallelize the whole thing. The function ...
0
votes
1
answer
50
views
C++ OpenMP: put complex variable in or before loop?
I have a loop that I want to process in parallel. Each thread needs an (independent) chunk of memory, but it can be overwritten in every iteration and needn't be reallocated. See the following example:...
0
votes
1
answer
74
views
How to use oneTBB along with openMP
In oneTBB, the number of tasks running in parallel are taken care of by the library to ensure the number of activated threads not exceeding hardware limit. And it also states that the nested ...
1
vote
1
answer
31
views
Assign MPI cpus-per-proc individually
I have a code that runs on 2 MPI process, each of them using multiple threads with OpenMP. My computer (Ubuntu) has 4 CPU (cores ?). Thus I made a small script to give 2 CPU per process such that each ...
0
votes
1
answer
30
views
Why OpenMP TASK postorder binary tree traversal uses single thread?
I'm new to OpenMP and try to write a postorder tree traversal using OpenMP TASK.
The tree is simple:
Node 2 (root) is the parent of 3, 4
Node 3 is the parent of 5, 6
Node 4 is the parent of 7, 8
The ...
0
votes
0
answers
29
views
MSVC compiler error for external variables and OpenMP's threadprivate
I am trying to compile a c++ application using MSVC (Compiler Version 19.32.31329 for x86). The author of the application has complied it successfully using GCC 8.3, 9.3, and 10.3.
I run into an error ...
0
votes
0
answers
53
views
OpenMP private class member std::vector
I have a class member std::vector<double> chi_ which I would like to use in a parallel for loop where each thread sees a different version of chi_. However, even when using private(chi_) it's ...
2
votes
2
answers
128
views
How can i avoid the "i" dependency in this loop? Fortran
I'm working with OpenMP in my code, but in order to do that I have to solve this dependency:
do q=1,pppp
i=0
DO j=1, pppp
do c1=1,3
vect(c1)=xx(q,c1)-xx(j,c1)
...
3
votes
1
answer
59
views
OpenMP: Assign threads one iteration at a time
Say you have a loop containing a varying number of iterations and 4 cores
I understand that
#pragma omp parallel for
will basically divide the iterations in like this with chunks of size/4 length
| ...
0
votes
2
answers
75
views
OpenMP tasking issues with Intel compilers (and clang)
The code below shows problems with with OpenMP tasking in ICL 2021.6.0 and in ICX 2022.1.0 (Clang based)
Firstly, I am wondering if I am doing something fundamentally wrong in my OpenMP code and it is ...
0
votes
3
answers
48
views
OpenMP device offload reduction to existing device memory location
How do I tell OpenMP device offload to use an existing location in device memory for a reduction? I want to avoid data movement to/from device. Results will only be accessed on the device.
Here's my ...
0
votes
0
answers
39
views
OpenMP task in a 'single' directive [duplicate]
I have a code snippet that looks like this.
When i try to execute this,i was able to see multiple threads on this particular are of code, even if i am using '#pragma omp single ' directive above that....
1
vote
2
answers
127
views
Understanding the speed up of openmp program across NUMA nodes
I came across this behavior of speed up and I am finding it hard to explain. Following is the background:
Program
Invocation of Gaussian Elimination method to solve linear equation within a loop to ...
0
votes
1
answer
60
views
Is there a way to install and use gcc on MacBook M1?
I am trying to install and work with gcc compiler on my MacBook M1. I have installed gcc using home-brew, but I did not find a way to use it on the terminal in my Mac. I wanted to download a tool that ...
2
votes
1
answer
57
views
How do i get a private vector while still using functions with openmp?
Im trying to parallelize my code with openmp.
I have a global vector, so i can excess it with my functions.
Is there a way that i can asign a copy of the vector to every thread so they can do stuff ...