Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [openmp]

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

0
votes
1answer
72 views

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

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
32 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
165 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
108 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
2k 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
377 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
1k 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
563 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
64 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
102 views
2
votes
1answer
493 views

Multiply two 4x4 Matrices

...
0
votes
2answers
431 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
684 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
507 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
108 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
513 views

OpenMP workaround for barrier in loop

What I basically want to do is this: ...
1
vote
0answers
46 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
429 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 ...
7
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
457 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, ...
1
vote
0answers
93 views

Big Integers and parallel execution with OpenMP

This is part of an implementation of Rabin-Williams signatures as described by Bernstein in Section 6 of "RSA signatures and Rabin–Williams signatures: the state of the art" using Tweaked Roots. The ...
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, ...
4
votes
1answer
523 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
379 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 ...
13
votes
2answers
399 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
298 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
614 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
220 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
404 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
862 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: ...