Questions tagged [openmp]
OpenMP is a cross-platform multi-threading API which allows fine-grained task parallelization and synchronization using special compiler directives.
6,347
questions
0
votes
0
answers
60
views
Performance profiling multitheaded OMP C++ in Visual Studio
I'm currently profiling a heavily multi-threaded C++ currently running under Visual Studio 2017. Looking at the results under task manager, my program is keeping all CPU cores and threads running at a ...
0
votes
1
answer
37
views
OpenMP critical section matrix multiplication
First of all I know the example is not a noticeable improvement from a single threaded execution. I am learning the basic of OpenMP and I dont know why it doesnt work as I expected.
So, I am ...
0
votes
1
answer
45
views
OMP loop dependency -
I try to parallelize the following code
double a = 1.5;
double b = 2.5;
double *arr = ...;
for (i = 0; i < N; ++i)
{
arr[i] = b;
b *= a;
}
I have tried different constellations of ...
0
votes
0
answers
21
views
Using OpenMP parallel 'for' directive on nested for loops
I have a Nx*Ny long vector phi which I want to perform some operations on to obtain d_phi. Basically each line adds together a linear combination of some of the columns of phi according to the ...
0
votes
0
answers
9
views
Can we extract device/kernel code from a .ll file(LLVM IR) in openmp application?
I am trying to write a simple addition application using OpenMP in which I want to offload the computation on GPU. My kernel code is present in a kernel.ll file in LLVM Intermediate Representation. ...
-4
votes
0
answers
39
views
Template Function in C++ [duplicate]
The code is so large and a bit to complicated so ill try to narrow it down.
We have ClassX, defined like this
template<typename T, bool B>
class ClassX {
// Function that takes in a different ...
0
votes
0
answers
65
views
Clear unordered map before running parallel creation of adjacent list - OpenMP C++
I'm trying to make a benchmark that measures the time taken to create the adjacent list of a graph, given its list of edges using OpenMP with different number of threads.
In order to do so I have to ...
0
votes
0
answers
10
views
How should i ovverride the GCC runtime compiler options for specific GPU
Using the GCC compiler and OpenMP programming, I’m now working on a project that offloads data to an Nvidia GPU. I needed some help in figuring out an issue .
The default setup uses a virtual GPU that ...
0
votes
0
answers
31
views
Odeint integration and parallel computing with openmp
I am trying to implement the three body problem integration in c++ with odeint but, to evolve, the system takes much time (about 10 h for just 50 years of integration of the system), so I would like ...
2
votes
1
answer
56
views
Enabling OpenMP tool with callbacks in a C++ code
I'm developing a small OpenMP tool library that will allow me to utilise OpenMP callbacks. This library is written entirely in C. I can compile and link it into my user code. To compile the library I ...
0
votes
0
answers
33
views
Why does this cmake code work with a hardcoded path, but not with a computed one of the same value? [duplicate]
System info
macos 12.5.1
Compiler Apple clang 14.0.0
Cmake version 3.24.2 from brew
OpenMP version 15.0.7 from brew, this installs the library in /opt/homebrew/opt/libomp/
The problem
I am debugging ...
0
votes
2
answers
44
views
Can I use a temporary 2D-array to avoid data dependency in OpenMP?
I have a piece of code like this:
int n=5;
Eigen::VectorXd vec(n);
vec.setZero();
for(int i=0;i<100;i++)
{
int idx = i%n;
vec(idx)+=(i/n);
}
std::cout<<vec<<endl;
I would like ...
0
votes
1
answer
60
views
Can Intel oneTBB co-exist with OpenMP?
I have a quick theoretical question. Can Intel oneTBB (Thread Building Blocks) co-exist with OpenMP (Open MultiProcessing) in one code base? Both are parallel runtimes for shared memory architectures. ...
0
votes
0
answers
58
views
Why does my sudoku solver work in serial but not in parallel using openMP?
I am writing a code that solves a NxN soduku puzzle in parallel using openMP. The code works fine when i compile without -fopenmp option, but when I compile with -fopenmp I get weird results.
Here is ...
0
votes
1
answer
50
views
OpenMP - Nested parallel for loops within sections
I have a time integration for loop, within which (to find the values of the arrays at the next time step) I am computing three equations essentially and each of the three equations are independent of ...
2
votes
1
answer
54
views
fortran triply nested do loop omp parallelization false sharing removal
I have the following fortran subroutine, which gprof shows that it consumes > 50% of the time and is by far the most expensive part of the code.
Initially I received it without any OpenMP directive....
0
votes
0
answers
33
views
Performance using OpenMP doesn't increase beyond 2 threads
I've created an implementation of the naive N-body problem with N^2 time complexity using c++ and I've tried to parallelize it using OpenMP. For example, running the program 5 times with 1000 bodies, ...
0
votes
0
answers
29
views
CMake - allow mingw with OpenMP and opencv
I try to set up a C++ environment for working with images (using opencv) and parallel computing. The main problem is that I can't success to link all the pieces together. As a mention, I use mingw ...
0
votes
0
answers
41
views
intelMKL - ZGEMM calls inside OMP parallel do region
I have matrices of maximum shape (2500 x 2500) , to be multiplied by vectors of maximum shape (2500, ), the result having of course a maximum shape of (2500, ).
These are all complex*16 datatype ...
0
votes
0
answers
37
views
does this triply nested do loop produce false sharing in OpenMP Fortran?
I am trying to parallelize a code I inherited from someone.
I am still learning about OpenMP.
I know that if multiple threads bounce back and fort a cache line and at least one of them writes to it, ...
0
votes
0
answers
49
views
can't compile c++ program with OpenMP
I'm a newbie so please forgive me my primitive developer language :)
I´m trying to compile a C++ program in Visual Studio Code and it works fine for me, but when i try to run the exe file on different ...
0
votes
0
answers
36
views
OpenMP C++ handles complex for loop parallelism
I am working on this legacy C++ code and trying to apply OpenMP to the code. The code has many for loop calculations which involves many element indexes stored in global variables. I am struggling to ...
0
votes
0
answers
38
views
Change in Results from A 30 Thread Machine to a 128 Thread Machine?
I had a question regarding the results I'm getting from intel compiled Fortran code between an original two CPU 36 xeon 2690v2 (I think) thread machine and a newer two CPU 128 Xeon 6338 thread machine....
0
votes
0
answers
61
views
Version node not found for symbol when static linking libgomp.a compiled with fPIC
I'm trying to recompile gcc/gfortran with -fPIC so that I will be able to statically link the libraries with position-independent compiled objects using
# gcc/gfortran configured and compiled with
./...
1
vote
1
answer
48
views
What is the "_8" postfix that is appended when linking openmp library fortran calls?
I'm compiling and trying to link together a couple of libraries, one issue that seems to arise is that a call to openmp in Fortran, like for example.
!$ CALL omp_set_num_threads(foo)
ends up ...
0
votes
1
answer
45
views
I am trying to compile a C/C++ program with OPENMP in linux and I have the following error message
The error message is:
error: ‘threadprivate’ ‘ramseries::ErrorWriter::activated_’ directive not in ‘ramseries::ErrorWriter’ definition
I can compile my program in windows but not in linux
Is it not ...
1
vote
1
answer
37
views
Why does this code for chain matrix multiplication return a segmentation fault?
I was writing a program to execute chain matrix multiplication for number of rows and columns being random numbers greater than 1000. The program performs chain matrix multiplication for 10 matrices ...
0
votes
0
answers
20
views
Is OpenMP in XGBoost automatically executed in Windows?
I was trying XGBoost in R, and I found an argument nthread specifying how many threads will be used to run the model (seems like parallelized computations). I guess this will improve the speed of ...
-1
votes
0
answers
70
views
Multi threading filesave C++
I would like to multi-thread a nested for loop.
Part of it is doing a long computation:
(GlauberOnce(Glauber,T_relax,T_evolve,J);
measure->transform01(Glauber->SpinsHistory);)
and another part ...
1
vote
1
answer
55
views
Performance MPI and MPI+OpenMP. Speedup and efficiency
The program I used to measure performance has an implementation in MPI and one with OpenMP+MPI where 2 threads and 4 threads are used to parallelize the loop present in the program. The program ...
0
votes
0
answers
40
views
Parallelization of an openMP nested do loop using ifort
I have a nested do loop in an openmp fortran 77 code that I am unable to parallelize, when doing the command export OMP_NUM_THREADS=14, the more threads I add the worse the results, when its " 1 &...
1
vote
0
answers
89
views
OpenMP: why is my parallel code is SLOWER than serial code? using FFTW
I have a code that uses FFT heavily, and a quick profiling shows indeed that the computer spends a significant portion of wall-clock time in my FFT functions. I have a simple attempt of using openMP ...
3
votes
0
answers
74
views
Intel MKL multi-threaded matrix-vector multiplication sgemv() slow after little breaks
I need to run a multi-threaded matrix-vector multiplication every 500 microseconds. The matrix is the same, the vector changes every time.
I use Intels sgemv() in the MKL on a 64-core AMD CPU. If I ...
2
votes
1
answer
63
views
How to generate the same random number sequence within each thread?
I have a code that converts an image with 32 output layers, from an AI segmentation model output, into a single layer where each pixel in each layer has a probability proportional to its score to make ...
1
vote
2
answers
52
views
OMP Atomic Assignment to Pointer Location and Pointer Increment
I have a need (particle binning) for multiple threads in a OMP SMP parallel region to determine which array to write data to and then increment a counter to track how much data has been written. The ...
-1
votes
1
answer
71
views
Problem with outer loop vectorization using OpenMP in C
I am lerning how to use OpenMP to make a code use muttiple processors. Recently, I tried to make my Ewald Summation Fourier part parallel using OpenMP. Below is the function named ...
0
votes
1
answer
25
views
Array overwriting(?) in OpenMP
As an introduction to OpenMP, I'm trying to print a list of prime numbers.
// compile: gcc primes.c -fopenmp -o primes
#include <stdio.h> //printf()
#include <stdlib.h> //atoi() and ...
-1
votes
1
answer
52
views
Optimizing huge graph traversal with OpenMP
I am trying to optimize this function which according to the perf tool is the bottleneck of archiving close to linear scaling. The performance gets worse when the number of threads go up, when I drill ...
0
votes
1
answer
68
views
Compiled successfully, but no console output
I'm trying to use LLVM on windows.
I've installed llvm-mingw(https://github.com/mstorsjo/llvm-mingw/releases/tag/20220906), and it works like a charm.
Everything works well, but pthread and openmp.
...
2
votes
0
answers
70
views
Restrictions for Fortran loops associated with the worksharing or simd loop constructs
OpenMP for Fortran has a few loop-related constructs like the work-sharing do loop construct, simd loop construct etc. These constructs can have one or more Fortran loops related to them. The latter ...
0
votes
0
answers
56
views
How to ensure each OpenMP thread has its own copy of thread_local variable in C++
I would like to make sure each OpenMP thread in a parallel block has a copy of a static thread_local variable. Please consider a code snippet below:
#pragma omp parallel
{
// autodiff tape
...
0
votes
1
answer
49
views
How to use OpenMP in Rcpp when calling functions from headers?
I have created many functions that I want to called in my current .cpp script. As usually, I do it by calling the headers (eg: my_function.h). The issue is that when I want to use OpenMP, my R session ...
3
votes
0
answers
59
views
Is seq_cst needed for synchronization of OpenMP atomic updates?
I read here that sequential memory consistency (seq_cst) "might be needed" to make sure an atomic update is viewed by all threads consistently in an OpenMP parallel region.
Consider the ...
0
votes
0
answers
43
views
Parallelise nested for loop where inner depends on outer with OpenMP
I have a function in C which I have to parallelize using OpenMP with static scheduling for n threads
void resolveCollisions(){
int i,j;
double dx,dy,dz,md;
for(i=0;i<bodies-1;i++)
...
0
votes
0
answers
41
views
cancel parallel for when result found without checking the rest of iteration?
I want to write a c++ function that checks for even numbers inside an array, but I want to do it in parallel with Openmp; if there is an even number inside the array, the function stops all other ...
0
votes
1
answer
38
views
Parallelise 2 for loops with OpenMP
So I have this function that I have to parallelize with OpenMP static scheduling for n threads
void computeAccelerations(){
int i,j;
for(i=0;i<bodies;i++){
accelerations[i].x = 0; accelerations[...
0
votes
0
answers
46
views
using omp threads inside function
I'm trying to play a little with omp threads. Inorder to make "main" function more clean, I want to use omp threads inside function which called by the main function.
Here we have an example:...
0
votes
0
answers
65
views
openmp task for matrix addition
void x(vector<vector<int>>&A,vector<vector<int>>&B,vector<vector<int>>&C,int n)
{
int i,j;
#pragma omp parallel
#pragma omp single
{
for (...
0
votes
0
answers
42
views
openmp tasks in nested loops
I am trying to write the following piece of code.
#pragma omp parallel
{
int .... some variables
for (int x:map){
int ...
#pragma omp single
{
#pragma omp task firstprivate(x,..) depend(out:a)
{...
-1
votes
1
answer
26
views
compile error on compile Livermore Loops coded in C
I want to compile and run Livermore Loops in C code
But every time I get compile error and I don't get any clear answer
This is a source code page
https://netlib.org/benchmark/livermorec
Can anyone ...