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
-1 votes
0 answers
20 views

invalid controlling predicate (openMP)

i am currently using openMP to parallelize my program but i get stuck at this line : #pragma omp parallel for schedule(dynamic) for (long int i = 2; (i * i) <= high; i++) { if (ck[i] == true) { ...
DeadlyKitten999's user avatar
0 votes
0 answers
44 views

OpenMP: How do I force one thread per iteration of a loop

I have a bunch of nested loops like the following do k=1,5 do i=1,10 write(k_str, '(I0)') k conf_unit_single1=19+thread_num+i open(conf_unit_single1, file='positions_'//trim(adjustl(k_str))...
A quarky name's user avatar
0 votes
0 answers
17 views

Jupyter Kernel Dead upon training LightFM Model `fit_partial`

When initially importing from lightfm.datasets import fetch_movielens, I get the following output: UserWarning: LightFM was compiled without OpenMP support. Only a single thread will be used. Then, I ...
Yaasd Palala's user avatar
2 votes
2 answers
98 views

OpenMP Memory Leak with STL (heap memory)

#include <malloc.h> #include <vector> #include <iostream> #include <chrono> #include <thread> void test_openmp(const size_t for_n, const size_t vec_n) { std::cout &...
markcsie's user avatar
0 votes
0 answers
74 views

What are the requirements to do a OpenMP reduction in Fortran?

I am doing molecular dynamics simulation, and trying to parallelize my serial code with the help of openmp constructs in fortran. At, first I am just trying to parallelize the force subroutine, which ...
Sayantan Mondal's user avatar
4 votes
1 answer
75 views

OpenMP SIMD Multi-Reductions (Sum, Min and Max) in Single For Loop

I have the following loop to calculate basic summary statistics (mean, standard deviation, minimum and maximum) in C++, skipping missing values (x is a double vector): int k = 0; long double sum = 0.0,...
Sebastian's user avatar
  • 1,117
0 votes
0 answers
24 views

Determining the serial fraction in a parallel program of Game of Life puzzle [duplicate]

I have a parallel program for game of life and I am trying to verify Amdahl's law for the same. Amdahl's law: $$\frac{1}{f + (1-f)/p}$$ However, I am not sure how to determine $f$(serial portion of ...
Aryan Sai's user avatar
0 votes
0 answers
46 views

Determining the serial fraction in a parallel program

I have a parallel program for game of life and I am trying to verify Amdahl's law for the same. Amdahl's law: $$\frac{1}{f + (1-f)/p}$$ However, I am not sure how to determine $f$(serial portion of ...
Aryan Sai's user avatar
-1 votes
1 answer
91 views

Monte Carlo with OpenMP

I am studying OpenMP and need to implement it into the monte carlo simulation for estimating probability of consecutive kings in a Shuffled Deck. However, after I implemented it, the time taken still ...
Alexander's user avatar
0 votes
0 answers
25 views

How can OpenMP influence a non-OpenMP code?

I am working on debugging a code. Let me say up front that it is not my code and I do not have permission to share a single line of it. I know we all like to see code, but that's my situation. It ...
bob.sacamento's user avatar
1 vote
0 answers
19 views

OpenMP + pybind11 (to be compiled with setup.py) on mac and linux

I have a python module that I want to make usable in both macOS and linux, that uses C++ code with OpenMP. I'm having issues on macOS (because apple clang doesn't have OpenMP support, I guess). I have ...
sodiumnitrate's user avatar
2 votes
1 answer
56 views

How to enable OpenMP with Multi-threaded FFTW in C/C++?

I was struggling with slow implemetnation of my FFTW in C/C++ when I read in their documentation that you should create all fftw plans once and execute many times, which I was able to implement ...
Jamie 's user avatar
  • 421
3 votes
2 answers
66 views
+50

Identifying source of and understanding OpenBLAS and OpenMP warnings

I am developing a deep learning model using pytorch, pytorch-lightning, and segmentation-models-pytorch. When I run pytorch_lightning.Trainer.fit(), I get hundreds of the following warning: OpenBLAS ...
sdg's user avatar
  • 144
0 votes
1 answer
59 views

Why do my functions not work in parallel?

I tried to use OpenMP in my C program for creating the Mandelbrot set. I use two functions f(z) and d(z) defined in the file. When I use them inside a parallel section direct code: dc = 5*z*z*z*z*dc + ...
Adam's user avatar
  • 1,256
2 votes
0 answers
27 views

Fortran derived type variable containing pointer fields with the shared attribute inside an OpenMP parallel region

I have the following problem: I would like to have access to data that is stored in a derived type with pointer fields. I would like the variable of the derived type to have the "shared" ...
user22593146's user avatar
0 votes
0 answers
13 views

CMake can't find OpenMP on `manylinux` images, even though it is installed

During a cibuildwheel --platform linux build using scikit-build on the quay.io/pypa/manylinux2014_x86_64 image CMake 3.27 cannot find OpenMP: -- Found OpenMP_C: -fopenmp (found version "4.5")...
Robin De Schepper's user avatar
0 votes
1 answer
75 views

c++ logging from parallelized loop

I have a parallel for loop and ONCE for looping I'd like to log some details. first_iteration = true; #pragma omp parallel for schedule(runtime) for (int j = 0; j < items.size(); j++) { if (...
Honza S.'s user avatar
  • 174
0 votes
1 answer
55 views

Openmp in fortran "Segmentation fault" [duplicate]

My system is on Debian 12 with an Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz. I am trying to parallelize some fortran code with openmp which uses the FFTW library and consists of several modules compiled ...
Marios Giannakou's user avatar
0 votes
2 answers
75 views

OpenMP task construct does not scale with the number of threads

I am using OpenMP task construct to parallelize the execution of a binary tree application. However, the runtime performance shows that single-threaded implementation outperforms multi-threaded ...
chchiu's user avatar
  • 1
1 vote
0 answers
42 views

OpenMP: Finding the maximum value of array using reduction clause

I have the following function that calculates the maximum value of 2D/3D arrays in a nested for loop. I used reduction clause to gain some additional speedup however I am not getting a good speedup ...
Jamie 's user avatar
  • 421
3 votes
2 answers
61 views

How does work the OpenMP "nonmonotonic:dynamic" schedule?

The two main OpenMP loop scheduling options are static and dynamic. The latter can be more efficient if the workloads are not balanced between the iterations, but less efficient in the case of ...
PierU's user avatar
  • 1,498
0 votes
1 answer
75 views

How to fast paralleled Code than nomal Code using OpenMP?

#include<opencv2/opencv.hpp> #include <iostream> #include <omp.h> #include "jaehyukTool.h" using namespace cv; using namespace std; void cpu_PeakFinder(Mat img , Mat* ...
이재혁's user avatar
1 vote
1 answer
57 views

Matlab exits without error upon clear mex with openMP

I ran into a weird case where Matlab closes without an error. I have the following mex file that uses OpenMP // main.cpp #include "mex.h" #include "omp.h" void mexFunction(int ...
rinkert's user avatar
  • 6,631
0 votes
0 answers
80 views

Why is the conversion from BGR to LCh much slower than the reverse in this C++ program?

I wanted an efficient way to convert an image represented by a three dimensional array of float values between 0 and 1 to an LCh D65 array, as a programming challenge. I know I can use OpenCV's ...
Ξένη Γήινος's user avatar
0 votes
1 answer
58 views

Passing vector by reference in OpenMP loop

Is it safe to update a vector passed by reference in an OpenMP loop? In this example, I update the vector out_vector from a function inside the parallel loop to which it is passed by reference. #...
user's user avatar
  • 1,037
1 vote
0 answers
91 views

Extent of Thread Safety in R/ Rcpp

I know that R, and by extension Rcpp, are generally not thread-safe. This script e.g. crashes R: // [[Rcpp::plugins(openmp)]] #include <Rcpp.h> #include <omp.h> // [[Rcpp::export]] Rcpp::...
user's user avatar
  • 1,037
-1 votes
0 answers
41 views

OpenMP crashes with resource allocation on two concurrent processes

I am running two sessions of Autodesk maya. We have a custom plugin that uses OpenMP for loop: #pragma omp parallel for for (int j=0; j<n; j++) {} For one session of Maya, I don't get ...
Syed 's user avatar
  • 548
0 votes
1 answer
57 views

choose different threads for diffrent tasks in a fortran code by using openmp

program main USE OMP_LIB IMPLICIT NONE INTEGER :: i,j,mm,m1,a,k,a1,b,bvv logical :: nn call omp_set_nested(.true.) call omp_set_max_active_levels(2) CALL omp_set_num_threads(2) !$omp parallel do ...
quantax's user avatar
  • 11
-1 votes
0 answers
32 views

How to identify issues within OpenMP parallel regions?

I have a simple C++ program that uses OpenMP, but I've noticed that once I set the number of threads to more than one, my calculations start to produce errors. However, I believe there doesn't seem to ...
YA xiang's user avatar
3 votes
1 answer
139 views

C++ OpenMP doesn't speed up matrix multiplication

I have written a simple matrix multiplication program in C++, and it works. I am just a beginner in C++ and I have managed to make it work. What baffled me was that it was much slower than NumPy. I ...
Ξένη Γήινος's user avatar
1 vote
0 answers
53 views

openmp additional sync points with loop static scheduling

I am trying to understand more details regarding static scheduling for openmp parallel loops. One question I came across when studying shared mem. programing with openmp. Let's say I have a simple ...
Base0's user avatar
  • 23
0 votes
1 answer
40 views

fortran segmentation fault when OMP_NUM_THREADS bigger than 1 [duplicate]

so im executing a.out (compiled fortran code) with the following runaout.sh file #!/bin/bash #SBATCH --time=00:15:00 #SBATCH --job-name=mhsw9 #SBATCH --nodes=1 #SBATCH --nodelist=komputasi09 whoami ...
LLL's user avatar
  • 223
0 votes
0 answers
52 views

OpenMP - how to get rid of implicit data maps?

Please take look at the following example: #include<cstdio> #include<omp.h> int main() { int x[100]; for(int i=0; i<100; i++) x[i] = 1; #pragma omp target data map(to:...
paww's user avatar
  • 23
-1 votes
0 answers
52 views

Parallelize 2 loops and distribute the third to one thread with openmp

I'm working on a N-body code written in C and I wish to parallelize 2 loops among the 3 that I've got in my C-code. Here's the code: for (i=0;i<nbody;i++) { for (j=i+1;j<nbody;j++) { ...
Brunodu94's user avatar
0 votes
0 answers
62 views

Is it safe to access (read-only) R matrices within a Rcpp::List from an openMP parallelized loop using a std::vector<double*>?

I wrote a piece of Rcpp code to speed up some treatment involving a R list of numeric matrices. As the number of matrix within the R list may reach hundreds of thousands, I started parallelizing this ...
Bubar's user avatar
  • 1
1 vote
1 answer
32 views

OpenMP atomic update of map value

Is the follwing increment operation thread safe? std::map<std::uint64_t, std::uint64_t> val_counts{}; #pragma omp parallel for num_threads(32) for (std::uint16_t ix = 0; ix < 96; ++ix) { #...
bocebir's user avatar
  • 13
2 votes
0 answers
134 views

OpenMP parallel code is slower than serial

UPD: Having sorted out the problem in the comments, I've updated the information below, which probably guarantees a solution to the problem. I want to get high-performance code using the OpenMP ...
Reptider's user avatar
0 votes
0 answers
117 views

profiling or debugging fortran on an M1 Mac

I am trying to debug and profile (ideally line-by-line time spent) Fortran code on an M1 Mac. Most commands I tried don't seem to work for Fortran and/or M1. gdb seems outdated and won't run lldb ...
John Smith's user avatar
  • 1,079
0 votes
0 answers
59 views

OpenMP using a large amount of CPU even for "do nothing" operations

I've inherited a project that uses OpenMP and I've found that the application inexplicably uses a lot of CPU even when doing nothing. Eventually I narrowed this down to the OpenMP usage (removing it ...
user2445507's user avatar
1 vote
0 answers
49 views

gfortran error ‘variable_1’ causes a section type conflict with ‘variable_2’

I'm trying to solve the possible problem of stack size being too small for an openmp fortran program with the compiler option -mcmodel=medium and error occurs while compiling: Error: ‘profs’ causes a ...
DJNZ's user avatar
  • 121
3 votes
0 answers
32 views

OpenMP offload pinned memory

I want to allocate page locked memory on host so that I get high bandwidth during data transfers. In CUDA, cudaMallocHost can be used to do this. How can I pin memory in OpenMP offloading? Currently I ...
aditya sadawarte's user avatar
3 votes
1 answer
148 views

What is the correct behaviour for nested task constructs?

I encountered an issue with nested task constructs (page 137) while testing MagIC. The application built with Intel, GNU and Arm compilers, shows inconsistent behaviours. While Intel and GNU compilers ...
JulieGaspar's user avatar
1 vote
1 answer
49 views

openmp default(none) questions

Trying to understand private and shared openmp data clauses. Hello everyone. I have the code like this: const int numRows = 4; const int numColumns = 100; int array2D[numRows][numColumns]; ...
Base0's user avatar
  • 23
1 vote
1 answer
60 views

How to use OpenMP with do-while loop?

I have an iterative solver that solves some sort of PDE (e.g. Poisson's equation) and requires a number of iterations to converege to the correct solution. This function in my code takes a big chunk ...
Jamie 's user avatar
  • 421
1 vote
0 answers
119 views

How to parallelize two nested for loops in this function?

So I have used a profiler to test my code and it shows that this particular function takes 30% of the total running time of the code used by this function. Naturally, I tried parallelizing this ...
Jamie 's user avatar
  • 421
0 votes
1 answer
53 views

How to parallelize the sparse matrix-matrix (SpMM) product with OpenMP for the COO format?

I recently coded a multithreaded version of the sparse matrix-vector (SpMV) product using a COO storage format: void dcoomv(SparseMatrixCOO *A, double *x, double *y) { for (int i=0; i<A->m; i++...
Nicolas Venkovic's user avatar
0 votes
0 answers
31 views

OpenMP GCC Design Documentation

I am currently investigating the level of effort required to add a new hardware architecture target offload accelerator to GCC. I am specifically interested in how the code in libgomp interacts with ...
JimW's user avatar
  • 1
1 vote
1 answer
99 views

Ifort gives segfault in OpenMP parallelized code when passing internal procedure as argument, but not gfortran

I have made a minimal example of my more complex Fortran code where I get segmentation fault when compiling and running with the Intel Fortran compiler ifort and not with the GNU compiler gfortran. If ...
Rasmus's user avatar
  • 139
2 votes
1 answer
168 views

MacOS compile error with clang: error: unsupported option '-fopenmp'

I got stucked in error during installing IpOPT on MacOS Ventura 13.4.1. I did ./configure as instructed in Ipopt Installation Instruction and tried compiling via: make However, the following error ...
Axolotl's user avatar
  • 21
1 vote
0 answers
30 views

Error in cancellation nested for loops using OMP

I am trying to parallelize nested for loops using OMP in c, and in some point i want to break both loops and stop all threads and exit the function. i tried to use #pragma omp cancel and #pragma omp ...
ahmad hajyahia's user avatar

1
2 3 4 5
130