Questions tagged [openmp]

OpenMP is a cross-platform multi-threading API which allows fine-grained task parallelization and synchronization using special compiler directives.

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

LLVM: How to use LIBOMP_ARCH to cross compile libomp for riscv64

I'm reading the LLVM documentation on how to build libomp in the LLVM repository. I've set LIBOMP_ARCH to "riscv64", and the cmake output shows -- LIBOMP: Target Architecture -- riscv64 ...
plafratt's user avatar
  • 748
0 votes
2 answers
66 views

OpenMP lock instruction in a function called by a parallelised loop

I have a function that I call in a parallelised for loop. Everything in this function can be done in parallel, except for one variable incrementation that need to be locked. I tried to put #pragma omp ...
Kiffikiffe's user avatar
1 vote
2 answers
49 views

Confusion with #pragma omp for

I'm new to parallel programming (just now learning it in class), and I'm a little confused as to what exactly this directive does...I've been told (and read online) that it uses worksharing to get ...
JBatswani's user avatar
1 vote
0 answers
53 views

How to use MPI with threads

As a beginner of MPI, I want to use mpi with several threads and each thread communicates using mpi. I tried several approaches but get some errors. First, I tried a very basic implementation like the ...
heyula's user avatar
  • 133
1 vote
0 answers
44 views

Parallel Quicksort using OpenMP giving slower results

This is my parallel section in the QuickSort algorithm void quicksort_recursion(int array[], int low, int high) { if (low < high) { int pivot_index = partition(array, low, high); #pragma omp ...
anndress07's user avatar
0 votes
0 answers
69 views

How to pass subarrays to gemv (BLAS95)?

I would like to multiply two subarrays (an 1D and a 2D) with gemv (BLAS95 subroutine), but the result should be saved as rows of a 2D array. What I tried to do is the following: program main use ...
Roland Tóbiás's user avatar
0 votes
1 answer
114 views

How to speed up dense matrix multiplication?

I want to speed up the mutiplication blow: And here is the code that I need to improve: void multiply(int size, int **matA, int **matB, int ** matC) { for(int i=0;i<size;i++) { for(int ...
Z.Lun's user avatar
  • 263
1 vote
0 answers
61 views

Error when using associate within an OpenMP loop in a Fortran code

I have the following MWE: program main implicit none integer i,ints(5) ints(:)=0 call omp_set_num_threads(5) !$omp parallel do default(shared) private(ints,i) do i=1,5 associate(ii=&...
Roland Tóbiás's user avatar
0 votes
0 answers
30 views

OpenMP First function call is slow

A parallelized function in C is slow on the first call. The subsequent call exectues ~5x faster. The number of calculations is exactly the same. The heavy lifting is done by this function which has ...
n1nj4's user avatar
  • 516
-3 votes
0 answers
39 views

SIEVE OF ERATOSTHENES OpenMP [closed]

I have written the following code and trying to parallelize the SIEVE OF ERATOSTHENES it using openmp the Serial code is : #include <stdio.h> #include <stdbool.h> #include <string.h> ...
Kusai Almahamid's user avatar
0 votes
0 answers
38 views

Result of parallizing for loop with OpenMP varies just slightly from sequential run

I am trying to parallelize a for loop for a simple ray tracing program using OpenMP. It all seems to work fine, and the generated file seems to be almost identical to the sequential output put there ...
handelskonig's user avatar
1 vote
0 answers
33 views

cannot read spec file ‘libgomp.spec’

trying to compile a C++ application with OpenMP offloading on Ubuntu 23.10 with GCC 13, and I get the error message x86_64-linux-gnu-accel-nvptx-none-gcc-13: fatal error: cannot read spec file ‘...
Simon's user avatar
  • 268
0 votes
2 answers
95 views

OpenMP: Fortran: Add Reduction on a Matrix

I have a large N-by-T element matrix named DATA (T is the number of threads). I want to add elements of each row of DATA to produce a single N element output vector named SUM. This is the serial ...
JB_User's user avatar
  • 3,147
-1 votes
0 answers
40 views

C/Macros/OpenACC&OpenMP target device

I'm currently encountering a problem with C macros. I'm trying to create a macro for OpenACC and OpenMP directives specifically for GPUs. I'm able to compile the code for both OpenACC and OpenMP ...
Nitin Shukla's user avatar
0 votes
1 answer
46 views

Increase speedup with OpenMP and reductions

I would increase speedup of these code with OpenMP. for (i = 1; i < length; i++) { for (j = 1; j < i; j++) sum_c += c[j]; c[i] = sum_c + W[i]; sum_c = 0; } I try with these ...
kilerin's user avatar
1 vote
0 answers
40 views

OpenMP Declare Reduction clause not working in Visual Studio

I have a function to count primes in parallel using open mp's parallel for syntax and I am trying to use a custom reduction function that merges in order two vectors: void mergeVecs(std::vector<...
camdenmcgath's user avatar
-3 votes
0 answers
53 views

Clang: Unsupported option -fopenmp Qt MacOS

I'm working on a project in Qt creator, and in the .pro file I have the following: QMAKE_CXXFLAGS+= -fopenmp -Wall LIBS += -fopenmp and I am getting the error: Clang error: unsupported option 'fopenmp....
blov's user avatar
  • 1
-1 votes
0 answers
51 views

OpenMP Conditional Reduction

My OpenMP code uses reduction clause, but the reduction itself is conditional. What's the best way to handle this? Let's say I'm trying to search for a bunch of items in an array and I'm keeping a ...
Siddharth Subramanian's user avatar
0 votes
0 answers
72 views

Calling fortran executable file from matlab is much slower

I have a fortran code compiled into a exe file. I can run it directly through the command line, or simply call the executable from matlab. This two approaches lead to massively different execution ...
phdstudent's user avatar
  • 1,058
0 votes
1 answer
64 views

Cuda multi-device asynchronicity with pageable memory

Does Cuda offer a mean to obtain asynchronicity between different devices using pageable memory on the host ? (note that this is not about the never-ending questions about blocking cudaMemcpyAsync on ...
Samuel's user avatar
  • 21
0 votes
0 answers
34 views

Can one program with idle MPI ranks/cores utilize the idle underlying cores as OpenMP threads for the non-idle ranks?

I'm running into an edge case between pure MPI and hybrid MPI+OpenMP, and I'm not sure how to get MPI+OpenMP to do what I want, but also afraid I'm running into an XY problem. Let's say I run a ...
NoseKnowsAll's user avatar
  • 4,603
1 vote
0 answers
48 views

Open MP without respawn team of threads

I have the following code structure and would like to parallelize the loop in function2 using OpenMP: // main.cpp for (int i = 0; i < 1000; ++i) { function1(); } // function1 in module1.cpp float ...
Mono's user avatar
  • 11
0 votes
1 answer
31 views

What is the execution time of a parallel OpenMP application?

Let's say that we run an OpenMP application with N threads and for each thread we record its execution time using omp_get_wtime. In this way we get N execution times, one time for each thread. Which ...
Athanasios Margaris's user avatar
-2 votes
0 answers
61 views

Using pow for openMP for GPU

I am trying to run an OMP for loop on GPU that is using pow to calculate the power of a value and when running openMP for GPU it doesn't recognise the pow function #pragma omp target teams distribute ...
Andrew Chedid's user avatar
0 votes
1 answer
31 views

How to use a local version of openMP? (GOMP)

I'd like to bring up some changes (just some prints momentarily) to the GOMP library that I've downloaded from the git repo but seems like what I'm doing is not really effective because there's no ...
matteo's user avatar
  • 13
0 votes
2 answers
89 views

Processing a shared array by a passed index in a subroutine in a parallel loop

In a parallel loop, I process a shared array using a subroutine to which I pass the array and the current private-do index as parameters, but the program crashes with an array out-of-bounds error. How ...
DJNZ's user avatar
  • 121
0 votes
1 answer
83 views

Can this loop in the Arithmetic Numbers Calculation Problem be parallelised?

I suppose that divisor_count and divisor_sum variables could be reduction variables for threads in the potential parallelisation of the outer loop. I am just a bit confused if that parallelisation is ...
Pavle Šarenac's user avatar
0 votes
0 answers
63 views

Why does code with the OpenMP library run longer in parallel mode than in sequential mode?

I have a problem with using omp.h library.The task was to create and test an algorithm for solving equations using the Gaussian method using examples with a large number of equations (from 500).The ...
Viceversa's user avatar
0 votes
0 answers
30 views

Difference in printing private and shared array in OpenMP [duplicate]

I am using an array and printing it from three threads. The options I have chosen for the array is declaring it as private and shared. The array is declared private with OpenMP clause. The code is ...
David's user avatar
  • 1
-2 votes
0 answers
55 views

Matrix Multiplication with MPI and CUDA - GPU Time Increases with Multiple GPUs on Supercomputer

I am working on a matrix multiplication task that leverages both MPI (Message Passing Interface) and CUDA for parallel processing. However, I have encountered an unexpected issue when benchmarking the ...
MrZack's user avatar
  • 11
3 votes
0 answers
47 views

OpenMP collapse giving wrong result

I am new to c++ and i am testing how to use OpenMP for parallelisation with multiple for loops, I have noticed that after trying 5 loops with collapse, i end up with the number 1,410,065,408 void ...
Pixel's user avatar
  • 35
0 votes
2 answers
140 views

Vectorizing a loop with a "continue" branch in it

I am currently undergoing a course in which we were given access to a supercomputer. The CPU is an Intel(R) Xeon(R) Gold 6240 CPU. Our task was to vectorize (but we were not allowed to use ...
ampersander's user avatar
3 votes
1 answer
79 views

Setting IEEE FPE halting mode for OpenMP threads

Consider the following Fortran + OpenMP program. use ieee_exceptions implicit none integer, parameter :: n = 100 real :: nom(n) integer :: denom(n) logical :: ...
Vladimir F Героям слава's user avatar
0 votes
1 answer
72 views

What happens when clang-built program links against both libomp and libgomp?

I have a C/C++ program with various dependencies that come from my Linux distribution. Some of the dependencies are linked with GCC's OpenMP library libgomp.so. My program itself has its code compiled ...
nh2's user avatar
  • 24.8k
0 votes
0 answers
48 views

Optimal scheduling and placement of embarrassingly parallel job

I'm trying to optimize run time of an embarrassingly parallel code. I'm hoping there is something out there that can do this already and I just didn't see it in my searches. Info... The code is ...
js1's user avatar
  • 3
1 vote
1 answer
34 views

clang OpenMP loop continues counting beyond loop condition limit

I have the following interesting problem: #include <iostream> #include <omp.h> using namespace std; int main(const int, const char **) { const size_t n = 13; // triggers the issue //...
nh2's user avatar
  • 24.8k
0 votes
0 answers
22 views

Setting Different OMP_NUM_THREADS Value per Node in Distributed MPI Job

I can run an MPI job this way: mpirun --hostfile Hostfile -x OMP_NUM_THREADS=1 ./a.out Where the Hostfile contains: node1 slots=2 node2 slots=2 This currently sets OMP_NUM_THREADS=1 in all of the ...
Carlos Andrés del Valle's user avatar
0 votes
1 answer
143 views

tensorflow_cc results in Undefined reference to `omp_in_parallel@VERSION'

I installed tensorflow-opt-cuda on Arch linux, but trying to link as g++ -fopenmp "CMakeFiles/intro-hello-world.dir/hello-world.cc.o" -o intro-hello-world /usr/lib/libtensorflow_cc.so /usr/...
Carlo Wood's user avatar
  • 5,906
0 votes
2 answers
64 views

Why can't reduction be used with OpenMP tasks?

This is the code for calculating a numerical approximation of the area of the Mandelbrot Set. I don't understand why can't I write reduction(+ : numoutside) instead of shared(numoutside) when ...
Pavle Šarenac's user avatar
0 votes
2 answers
55 views

openmp atomic update vs critical section

Sequential loop, critical section, atomic update. I have a 2D graph consisting of vertices and edges. For each vertex, I want to compute the number of degrees of freedom (dof). A vertex dof = the ...
Base0's user avatar
  • 23
0 votes
1 answer
65 views

What does `use omp_lib` actually do?

According to this guide, one needs to include use omp_lib to enable openmp functionality. However, if I compile with ifort -qopenmp my code executes fine and I get the expected speed up, regardless if ...
M0M0's user avatar
  • 214
0 votes
0 answers
101 views

Can't achieve desired output on c++ multithreading program

It seems no matter what I try results always come out in order. I'm using visual studio code on ubuntu. I've looked at multiple tutorials (for example this one: video environment config, used all the ...
Peepee's user avatar
  • 1
0 votes
1 answer
115 views

Repeated single precison complex matrix vector multiplication (speed and accuracy improvement)

I've boiled a long running function down to a "simple" series of matrix vector multiplications. The matrix does not change, but there are a a lot of vectors. I have put together a test ...
js1's user avatar
  • 3
3 votes
1 answer
68 views

OMP parallel nested for cycles

I'm trying to multiply two n by n matrices using omp in C. But my code only calculates the diagonal elements. Here is the code: My code # include <stdio.h> # include <omp.h> int main(void)...
Diego Bravo's user avatar
1 vote
0 answers
56 views

OpenMP shared variable behaves like private

#pragma omp parallel shared(c,z) { #pragma omp for private(i,j) for(i=0;i<righe;i++) { printf("Z=%d\n",z); for(j=0;j<colonne;j++) printf("...
Max Tolomeo's user avatar
-1 votes
1 answer
71 views

Output of the number of iterations processed by each thread

I have code that processes a matrix in parallel and should output information about how many iterations each thread has processed, but it only outputs information for one thread. I started studying ...
Salivan's user avatar
  • 75
1 vote
1 answer
56 views

How to translate an openMP parallel region into MPI in fortran

I coded a Discrete Element Model that computes the interaction between particles. As a first step, I used openMP, and did some scaling analysis on a supercomputer cluster, and I am now ready to ...
Sogapi's user avatar
  • 23
1 vote
1 answer
107 views

'malloc(): corrupted top size' After allocating more than 200K int

I got assignment to do Bucket Sort with openMP, and I decided to do Quick Sort on each bucket. The requirement wants me to test by keep increasing the amount of integers and change the number of ...
der Kirschbaum's user avatar
1 vote
0 answers
35 views

Undefined Reference to 'omp_get_wtime'

I am trying to run a C program on Clion using OpenMP. All my earlier programs ran but for some reason this one isnt. I have included the following in my main.c file: #include "qdbmp.h" #...
Om Mistry's user avatar
0 votes
1 answer
46 views

Compiling multiple versions of a function with different preprocessor variable values

I have the following function which uses OpenMP for parallelism: Real3 MyThing::compute(...) { // Do some setup... #pragma omp parallel num_threads(OMP_THREADS) { // Local variables... ...
Sean Bone's user avatar
  • 3,398

1
2 3 4 5
131