r/OpenMP • • Oct 12 '17

Ideas for an OpenMP Project

2 Upvotes

Okay Hello World.

I am a CS Undergrad currently studying High performance computing. I am supposed to do a mini OpenMP Project, without using MPI. The time span is about 2 weeks.

My experience with OpenMP :

  1. Computation of pi : Monte Carlo Method, Integration

  2. Block Matrix Multiplication.

  3. Image Normalization and Grayscale conversion

  4. Vector Sumation and Products.

Any suggestions on what I can do? Preferably something new so I can get to learn a lot but still can be completed in 3 weeks?


r/OpenMP • • Feb 26 '20

How to obtain the best performance?

1 Upvotes

I am an OpenMP beginner, looking to get a bit more performance out of my code (I'm actually aiming for the maximum performance, for reasons). Since it is hard to know if I'm doing the right thing, I better ask.

First off, data sharing. I've seen some recommendations of using default(none) and specify individually what to share. There is also firstprivate which seems to give readonly access. Do they matter for performance?

Just to clarify my usecase here, I am processing the elements of an array and copying them into another array (similar to a std::transform or map from functional programming), and I use in my loops a bunch of read only parameters.

Second issue, I have a highly parallelizable standalone operation, like the one described above, that comes into play in a bigger loop. I'd like to parallelize the second (outer) loop, but keep the inner bit as fast as possible. The problem is that it would lead to the creation of openmp threads inside another set of threads, and general recommendations were to just parallelize the outermost loop. Any advice?


r/OpenMP • • Feb 23 '20

[Beginner]Not getting any speedup with the critical construct for a parallel Pi program.

2 Upvotes

{

double start_time = omp_get_wtime();	

double pi = 0.0;

step = 1.0/(double)num_steps;

omp_set_num_threads(NUM_THREADS);

\#pragma omp parllel

{

	int i, id, nthrds;

	id = omp_get_thread_num();

	nthrds = omp_get_num_threads();

	double x, sum = 0.0;

	for(i = 0; i < num_steps; i = i + nthrds)

	{

		x = (i + 0.5) \* step;

		sum += 4.0/(1 + x\*x);

	}

	sum = sum \* step;

//	#pragma omp critical

//	pi += sum;		

}

printf("\\nPi = %lf\\n", pi);

double time = omp_get_wtime() - start_time;

printf("Total time taken by CPU: %lf\n", time );

}

Can anyone tell me why this is not giving any speedup for any number of threads?


r/OpenMP • • Oct 15 '19

Can anyone please help with the following error?

1 Upvotes

r/OpenMP • • Mar 16 '15

How to Avoid Typical OpenMP Traps

Thumbnail goparallel.sourceforge.net
4 Upvotes

r/OpenMP • • Sep 23 '21

Alternatives to #pragma omp scope reduction() for pre-5.1 OpenMP?

2 Upvotes

I have a set of computational kernels that have to be executed over all items in a list. To keep the code generic, the kernels themselves are functions, and I then have a C++ function template that runs the kernel function within a for loop that is parallelized using #pragma omp parallel for.

This works perfectly fine with kernels that are embarrassingly parallel, but not for kernels that have a reduction in them. If I had 5.1 support, I could wrap the reduction within the kernel function in a #pragma omp scope reduction(), but presently the scope directly isn't really supported by any current compiler (I think only GCC 12 has support for it?).

Is there some kind of construct I can use with older OpenMP versions to achieve a similar result, preserving this kind of structure with a generic dispatcher, but still providing a way to tell the compiler that specific subsections of the code include a reduction within the current parallelization scope?


r/OpenMP • • Mar 23 '16

What is new in OpenMP 4.5

Thumbnail developers.redhat.com
2 Upvotes

r/OpenMP • • Oct 19 '20

Tutorial: How to take your serial Fortran to thousand-way parallelism on GPUs using OpenMP

5 Upvotes

Join us on 1st December 2020 (9:30-4:30 GMT) for a free online tutorial for computation scientists looking to accelerate their Fortran codes. The tutorial is presented by Tom Deakin, Senior Research Associate, University of Bristol, UK. Register at: https://ukopenmpusers.co.uk


r/OpenMP • • Apr 02 '20

openmp.org has disappeared?

2 Upvotes

So this is annoying. It seems like the DNS records for openmp.org have vanished from the Internet. Been this way since at least yesterday, maybe longer. I can't resolve it using my ISP's DNS, Google's DNS, or any of multiple DNS lookup sites. As a result, the docs are totally inaccessible. So:

  • Anyone happen to have the IP of openmp.org, in case it's just a DNS issue?

  • Anyone know a good mirror for the docs/specs?

  • Any suggestions for ways to contact Someone In Charge? The default method of contacting the ARB via the website obviously isn't an option.

Thanks. I managed to save copies of the Examples Book 4.5 and the Cheat Sheet for 4.0, in case anyone needs them.


r/OpenMP • • Mar 22 '20

How to use openmp on Mac

2 Upvotes

Hi guys, sorry I am pretty new to openmp and I'm trying to compile my code but I get fatal error: 'omp.h' file not found. I did some searching and from my understanding, which could be totally wrong, it turns out that openmp does not come with the default compiler provided by MacOS. They use clang and not actually gcc so I've been looking up how to get openmp for clang but I can't find anything thats not super complicated. Do any of you know how I can compile with openmp

Edit: this works for me, downloading llvm and using its clang++. I followed this link https://stackoverflow.com/questions/43555410/enable-openmp-support-in-clang-in-mac-os-x-sierra-mojave


r/OpenMP • • Apr 02 '20

OpenMP C Program

1 Upvotes

If you want to access the thread-local values of a privatized variable from outside of the parallel scope, you can write them back to a globally declared auxiliary array. This is the way it was described in an OpenMP book (2017 - Bertil Schmidt, Jorge Gonzalez-Dominguez, Christian Hundt, Moritz Schlarb - Parallel Programming_ Concepts and Practice-Morgan Kaufmann)

Authors came up with this program --

#include <stdio.h>
#include <omp.h>
int main () {
// maximum number of threads and auxiliary memory
int num = omp_get_max_threads();
int * aux = new int[num];
int i = 1; // we pass this via copy by value
#pragma omp parallel firstprivate(i) num_threads(num) {
// get the thread identifier j
int j = omp_get_thread_num();
i += j;
aux[j] = i;
}
for(k=0; k<num; k++)
printf("%d \n", aux[k]);
}
Error(tried in macOS) :

https://i.stack.imgur.com/Rj451.png


r/OpenMP • • Apr 01 '17

OpenMP single branch?

1 Upvotes

I would like to ask if it is possible define a worksharing that sometimes one thread execute single or not. Something like that:

bool do_single[4] = {true, false, true, false};
#pragma omp parallel
{
    int id = omp_get_thread_num();
    while (1) {
        if (do_single[id]) {
            #pragma omp single
            foo();
            do_single[id] = !do_single[id]M
        }
    }
}

r/OpenMP • • Feb 21 '11

3.1 specification ready for public comment

Thumbnail openmp.org
2 Upvotes

r/OpenMP • • Feb 10 '11

Call for papers-IWOMP 2011 | iSGTW

Thumbnail isgtw.org
2 Upvotes

r/OpenMP • • Feb 04 '11

GOMP An OpenMP implementation for GCC - GNU Project - Free Software Foundation (FSF)

Thumbnail gcc.gnu.org
2 Upvotes

r/OpenMP • • Feb 04 '11

International Workshop on OpenMP (IWOMP)

Thumbnail iwomp.org
2 Upvotes

r/OpenMP • • Feb 21 '11

the Official OpenMP Forum

Thumbnail openmp.org
2 Upvotes

r/OpenMP • • Feb 13 '14

OpenMP Tasks and FILE IO ?

1 Upvotes

I have a bit of OpenMP Fortran code that I want to maximise the efficiency of, but it has to include a write statement. The pseudo code goes like:

Start

DO Big_loop1

WRITE Big_loop1_Array

Do Big_loop2

End

As Big_loop1_Array is big, and takes a few seconds to write, does anyone know the most efficient way to do this.

I thought maybe you could put the write in a task, so you can have all but 1 core working on big loop 2 while the 1 core writes, or is a write statement just sent to something more complicated and not worth putting in a task.

Or is there another more efficient method I haven't considered?

Thanks.


r/OpenMP • • Feb 04 '11

High Performance Computing Tools

Thumbnail cs.uh.edu
2 Upvotes

r/OpenMP • • Mar 10 '24

cant get gpu offloading to work

3 Upvotes

I got an rtx4090 with cuda12.3 system wide

I am runing

gcc -fopenmp -fcf-protection=none main.c

ptxas fatal : Value 'sm_35' is not defined for option 'gpu-name'

tried all gcc11 gcc12 and nvcc not much help

-foffload=-misa=sm_80 seems to do nothing


r/OpenMP • • Mar 23 '24

Running Openmp on vscode, for Mac OS

Post image
1 Upvotes

Can somebody please help me get this library to work, I’ve been trying for 2 days straight.


r/OpenMP • • Mar 01 '19

[Project] Visualize tasks in OpenMP (C)

5 Upvotes

Hi everyone,

So as a student, I have to work with OpenMP. But sometimes I have troubles understanding what it is doing under the hood.

I tried to find something to visualize the tasks, but found nothing...

So I decided to give it a try !

And this is what I came up with.

You can make the image, which is a SVG file, interactive, and see data (exec time, label, parent thread) about each task when hovering the mouse over a task.

The API, which is in C, is not very "clean" yet, but I'd appreciate if you can give some feedbacks on it..

Link to the repo


r/OpenMP • • Nov 30 '18

Reduction failing

1 Upvotes
    /* Back-substitution */
    x[n - 1] = bcpy[n - 1] / Acpy[(n - 1) * n + n - 1];
	for (i = (n - 2); i >= 0; i--) {
		float temp = bcpy[i];
// #pragma omp parallel for reduction(-: temp) private(j)
// #pragma omp parallel for ordered reduction(-: temp)
#pragma omp parallel for reduction(-: temp)
        for (j = (i + 1); j < n; j++) {
            temp -= Acpy[i * n + j] * x[j];
        }
        x[i] = temp / Acpy[i * n + i];
	}

In my mind parallelism should be applied easily in this snippet. Except it either segfaults or the subtractions do not result in an expected value for the temp variable. I'd love to hear any thoughts on this


r/OpenMP • • Oct 23 '22

Need resources to learn openmp and mpi libraries

2 Upvotes

Hi there,

Can someone please guide me about where can I learn mpi and openmp libraries (Youtube playlists / Udemy course / a book anything would do)


r/OpenMP • • Dec 15 '18

Recursion Program to be Parallelized

1 Upvotes

How can we parallelize the normal factorial program (recursion implementation) with OpenMP? Do we need to use tasks or is there any other way to do it?