Questions tagged [openmp]

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

Filter by
Sorted by
Tagged with
3
votes
0answers
27 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: ...
-1
votes
0answers
56 views

Sobel filter for edge detection

I've tried to implement my own Canny edge detector and tried to make it as fast as possible. I tried to code most of the needed function myself and only used opencv as input/output. However, the ...
4
votes
0answers
26 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 ...
0
votes
1answer
152 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. ...
1
vote
1answer
38 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. ...
4
votes
1answer
331 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 ...
5
votes
2answers
114 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 ...
18
votes
2answers
3k 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 ...
3
votes
2answers
588 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 ...
2
votes
1answer
2k 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 ...
1
vote
2answers
869 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: ...
5
votes
1answer
75 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 ...
4
votes
1answer
125 views

Spatial Hash for optimizing AABB collisions

grid.h ...
2
votes
1answer
666 views

Multiply two 4x4 Matrices

...
0
votes
2answers
570 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 ...
5
votes
2answers
942 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 ...
3
votes
1answer
2k 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 ...
4
votes
4answers
757 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 ...
6
votes
0answers
124 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 ...
2
votes
1answer
859 views

OpenMP workaround for barrier in loop

What I basically want to do is this: ...
1
vote
0answers
52 views

Renumbering vertices in a 3D mesh

I'm just guessing if there is any room for improving performance on this code: ...
5
votes
0answers
471 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 ...
6
votes
1answer
1k 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 ...
6
votes
0answers
487 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, ...
2
votes
1answer
1k 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, ...
5
votes
1answer
568 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 ...
5
votes
1answer
407 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 ...
15
votes
2answers
439 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 ...
3
votes
1answer
93 views

Trajectory optimizations

Here's a function doing some trajectory optimization in the following manner: ...
1
vote
1answer
301 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 ...
3
votes
1answer
659 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 ...
4
votes
2answers
222 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 ...
6
votes
1answer
410 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 ...
6
votes
1answer
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). ...
4
votes
2answers
1k 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 ...
11
votes
3answers
923 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): ...
4
votes
2answers
7k 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? ...
4
votes
1answer
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: ...