Skip to main content

Questions tagged [openmp]

OpenMP is an API that supports shared memory multiprocessing in C, C++, and Fortran.

Filter by
Sorted by
Tagged with
7 votes
1 answer
239 views

Differential Evolution

I have a PR implementing differential evolution. I'm a bit concerned about the implementation and would like some feedback: The class could be a free function. However, there are so many parameters, ...
user14717's user avatar
  • 785
1 vote
1 answer
49 views

Create subset of points cloud from a predefined ones following two conditions

I'm trying to optimize algorithm 1 in my following code. First double loop, I calculate points beforehand which will run only once. Then I have the first version of ...
Ja_cpp's user avatar
  • 341
0 votes
1 answer
250 views

Parallelise numerical integration with OpenMP in C++

I would like to parallelise with OpenMP a one-dimensional integral using the integrate() function implemented in the Boost library. I found a rather obscure ...
CafféSospeso's user avatar
3 votes
0 answers
63 views

Accelerating this stacked matrix-matrix product in OpenCL

I am trying to compute a matrix-matrix product of N stacked complex double N x N matrices. For simplicity, I assume N = 512. I have written code in C++ parallelized with OMP and using OpenBLAS for the ...
sqrt6's user avatar
  • 31
1 vote
3 answers
545 views

Parallezing merge step and divide step in mergesort algorithm with OpenMP

We wrote a code that parallelizes the divide phase of the mergesort algorithm. I.e. every recursive call is assigned to a thread but our teacher was disappointed because he said we should also ...
New2Math's user avatar
  • 111
5 votes
2 answers
4k views

Calculating pi with Monte Carlo using OpenMP

I'm a C noob and I'm learning about concurrency using C. I came across an exercise in a book asking me to find the approximate value of Pi using the Monte Carlo technique with OpenMP. I came up with ...
emrepun's user avatar
  • 165
1 vote
1 answer
47 views

Optimize narrow phase contact detection for phyiscs simulation code

I'm trying to optimize the narrow phase of the contact detection in my code. I'm using OpenMP for multithreading. That is the starting code: ...
David's user avatar
  • 111
2 votes
1 answer
674 views

Prime numbers with array and OpenMP in C

...
user avatar
4 votes
1 answer
107 views

Kernel Interpolation C++

Purpose of this program is to calculate the velocity of ng = nxnynz particles at the Lagrangian points from the values at regular grid nodes. How can i speed up this calculation? I hope to receive ...
Luc Nguyen's user avatar
3 votes
3 answers
276 views

Calculation of Energy Spectrum using C++

My purpose is to calculate the energy spectrum of three-dimensional turbulent flow from three velocity components. The calculation is too expensive. Therefore, I hope the calculation time can be ...
Luc Nguyen's user avatar
1 vote
0 answers
61 views

openMP implementation of loop until predicate met

I want to implement in openMP a loop that terminates when a certain condition holds. In serial code the function body would simply be ...
Walter's user avatar
  • 465
4 votes
1 answer
188 views

Fortran 90 / openmp heat transfer simulation optimization

I'm a newbie playing around with Fortran 90 and openmp and wrote the code below (a simple 2D heat transfer simulation) for testing purposes. So far I don't see any speedup by using openmp / parallel ...
HotDogCannon's user avatar
4 votes
1 answer
450 views

Evaluating π using Monte Carlo methods - Serial vs OMP

I wrote this simple code for evaluating the π using Monte Carlo method. This is the serial version: ...
Ilmionome456's user avatar
5 votes
0 answers
60 views

Lightweight lock using OMP atomic

I am working on a Monte Carlo simulation using OpenMP multithreading. To avoid race conditions when multiple threads work on the same resolution element, I have implemented the following ...
user35915's user avatar
  • 151
0 votes
1 answer
2k views

Generating parallel random numbers in a thread-safe way and using them in computations implemented by class method [closed]

I have the following code that I managed to make thread-safe but I am not sure if I am using C++ technology optimally. ...
Hirek's user avatar
  • 125
1 vote
1 answer
49 views

BA network generator and Percolator with OpenMP and also Linear code

Here I uploaded a very basic Barabasi-Albert network generator and then a percolator which conducts percolation over the network following some rules. I have used openmp to parallelize the loops. ...
Digonto Islam's user avatar
4 votes
1 answer
966 views

Parallelized Sobel algorithm using OpenMP

I implemented the Sobel algorithm sequentially, and got decent performance (1.49 s) but wanted to improve it. I parallelized it with OpenMP and got a ~3x speedup (0.523 s). I'd like to do better, but ...
Laurentiu's user avatar
6 votes
2 answers
163 views

Finding non-self-intersecting paths of certain moves that touch all points in a grid

The problem I'm trying to solve is the following: You have a 10x10 grid and starting from the upper-left point you have to touch all the points, without passing through the points that have already ...
Dan Dan's user avatar
  • 633
18 votes
2 answers
4k views

Julia Fractal Drawing in C++

I'd like a code review for this program written to draw Julia fractals. I'm specifically looking for feedback on: Style: I haven't written much C++ before, so I'm interested in knowing better or more ...
jgunter's user avatar
  • 183
3 votes
2 answers
1k views

Image processing parallelization

I'm working in a big project so I decided to take just part of it which you can copy/paste and compile in your machine. You might get weird image at the end but that's fine, that's what I want. I'm ...
Ja_cpp's user avatar
  • 341
2 votes
1 answer
4k views

Making a faster parallel quicksort

I'm trying to take my existing parallel Quicksort and make it execute faster. Below is what I have but half the time the optimized version doesn't give me a faster time. I use them to compare big ...
Hunter Davis's user avatar
2 votes
2 answers
3k views

Generating random number inside a paralleled loop (openmp) [closed]

What is the most fast and safe way of generating random numbers inside a pararelled loop? I did as below but I'm not sure if it is correct or not: ...
stack coder's user avatar
5 votes
1 answer
164 views

Buffered RNG-wrapper using openmp in c++

I wrote a class around a UniformRandomBitGenerator, which in turn also satisfies the concept of a UniformRandomBitGenerator. It ...
ochsnerd's user avatar
4 votes
1 answer
376 views

Spatial Hash for optimizing AABB collisions

grid.h ...
J. H's user avatar
  • 189
2 votes
1 answer
932 views

Multiply two 4x4 Matrices

...
J. H's user avatar
  • 189
1 vote
2 answers
2k views

OpenMP SIMD Euclidean Distance

I'm using cv::norm() to compute the L2 distance between row vectors in thousands of dimensions (at least 4096 dimensions). I'm using an AVX2 machine and ...
user6321's user avatar
  • 347
6 votes
2 answers
2k views

Runge-Kutta fourth order integration

I have written a simple code for Runge-Kutta fourth order integration to solve a system of ordinary differential equations and parallelized it using OpenMP. I don't know if it is the best we can do ...
Abolfazl's user avatar
  • 235
4 votes
3 answers
6k views

Matrix multiplication with OpenMP parallel for loop

I tried implementing matrix multiplication with parallel for loop in OpenMP as follows. It runs correctly but I want to make sure if I'm missing anything. How does this determine the number of threads ...
SachiDangalla's user avatar
6 votes
4 answers
2k views

Monte Carlo estimation of π

My C program uses the Monte Carlo method to approximate the mathematical constant π, the ratio of a circle's circumference to its diameter (and, importantly for this code, 4 times the ratio of a ...
Explosion's user avatar
  • 171
7 votes
0 answers
224 views

Find an arithmetic expression near to target value

I wrote this program as an answer to Express a Number challenge on the Programming Puzzles & Code Golf site; it may be worth looking there for the context. The concept is simple (and familiar to ...
Toby Speight's user avatar
  • 75.1k
3 votes
1 answer
3k views

OpenMP workaround for barrier in loop

What I basically want to do is this: ...
yakoudbz's user avatar
  • 133
5 votes
0 answers
724 views

Calculating complex exponential numbers using OpenMP in Cython

I am trying to create a function that can either beat numexpr or perform comparably for the vectorized mathematical operation ...
Trekkie's user avatar
  • 151
6 votes
1 answer
3k views

Parallelizing an algorithm with OpenMP using a dynamic work queue

I'm looking for comments on the design, correctness and performance (not so much style) of a dynamic work queue for OpenMP worker threads. I have an algorithm that can be thought of in terms of some ...
alcedine's user avatar
  • 161
7 votes
1 answer
581 views

Gauss-Seidel+SOR

I am learning OpenMP+MPI hybrid programming. As an example I have chosen Gauss-Seidel+SOR. My implementation uses MPI_THREAD_FUNNELED style hybrid programming, ...
aka's user avatar
  • 171
2 votes
1 answer
2k views

Simple speed up of C++ OpenMP kernel

This function calculates the standard deviation of a patch, given a kernel size and greyscale OpenCV image. The middle pixel of the patch is kept if stdev of the patch is below the given threshold, ...
Pieter Bosma's user avatar
5 votes
1 answer
931 views

Neural Network Simulator with OpenMP

I wrote a simple neural network simulator (the biophysical kind) from scratch, and was hoping to get some feedback on how I can speed things up, or any C++ / compilation best practices that I can ...
ejang's user avatar
  • 151
5 votes
1 answer
525 views

Sparse matrix multiplication for billion by billion matrices

I have to do multiplication of two billion by billion sparse matrices (on a CPU), hence any help or hints in optimizing the below given code would be extremely useful. Note: I am only showing the ...
Vineet Yadav's user avatar
17 votes
2 answers
641 views

Parallelization of number factors using OpenMP

For a simple try at parallelization on my own outside of school, I've created a number factors calculator. I hope to eventually come up with something more creative. Since I don't have access to ...
Jamal's user avatar
  • 34.8k
3 votes
1 answer
108 views

Trajectory optimizations

Here's a function doing some trajectory optimization in the following manner: ...
embert's user avatar
  • 445
1 vote
1 answer
324 views

Generating Ulam numbers with OpenMP and single-thread versions

I'm making a program that takes an integer n and generates the first n Ulam numbers. I followed this guide about OpenMP. This ...
izabera's user avatar
  • 196
4 votes
1 answer
915 views

Implementation of MATLAB's `im2col`

The function im2col in MATLAB is very useful to vectorize Patch based Image Processing algorithms. The problem is the function isn't optimized and doesn't use C ...
Royi's user avatar
  • 582
4 votes
2 answers
259 views

Increasing performance of OpenMP based advection equation solver for Xeon Phi

I am solving linear advection equation in order to learn parallel programming. I am running this code on Xeon Phi co processor. Below is a plot of how it scales up with increasing number of threads. I ...
0b1100001's user avatar
  • 233
6 votes
1 answer
464 views

Optimizing multiplication of square matrices for full CPU utilization

Problem I am learning about HPC and code optimization. I attempt to replicate the results in Goto's seminal matrix multiplication paper. Despite my best efforts, I cannot get over ~50% maximum ...
user43443's user avatar
6 votes
1 answer
1k views

OpenMP parallel for critical section and use of flush

I am not sure about the place where flush should be used (if it is used at all here). ...
priyanka's user avatar
  • 205
4 votes
2 answers
2k views

OpenMP loop parallel for loop with function calls and STL vector

I have a function initialize_path_statistics(). I have used openMP to make it parallel. I am not sure where certain lines such as ...
priyanka's user avatar
  • 205
11 votes
3 answers
2k views

Pi Benchmarking in C

I wrote the following program to calculate n digits of Pi (where n could be anything, like 10M) in order to benchmark the CPU and it works perfectly (without OpenMP): ...
noobprohacker's user avatar
6 votes
2 answers
10k views

OpenMP parallelization of a for loop with function calls

Using OpenMP, is it correct to parallelize a for loop inside a function "func" as follows? ...
micheletuttafesta's user avatar
4 votes
1 answer
1k views

Vectors assignations and operations in a loop and parallelization with OpenMP

I use this piece of code to compute a short-time Fourier transform: ...
OlivierB's user avatar