openmp

OpenMP library specification

hello , i am new to open mp and i tried an sample program from the official site #include <omp.h> #include <stdio.h> int main() { #pragma omp parallel printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads()); } and i have set the library in the eclipse as libgomp in project Properties->GCC c++ linker-...

Adding a new #pragma

Hi, I am trying to add an extension to Openmp through a new pragma. I was wondering if there is any way I can define a new pragma and define a set of rules to generate the code. I was also wondering if there are any source-source compilers that allow me to specify a new pragma in openmp. Thanks in advance. ...

OpenMP : Is there a way for a thread to terminate all other parallel threads ?

I am experimenting with openMP for large data processing and relatively new to it. My input data set is huge and so I divided it into multiple subsets and each thread working on the subset of data. Each dataitem in the subset is acted up on by the thread. If one of the threads fails during its operation on any dataitem, i would like to t...

what is wrong with my openmp parellel programming

hello, i have a queue of urls and i am passing to an function it crawls and gets the url each url in a queue should be in parellel and crawl is an class and start is my function it crawls the url and if i run the program the each urls is executed one by one not in parallel while(!q.empty()) { #pragma omp parallel for ...

OpenMP parallelization and deleting from a vector of lists

Hi, gang. First, a high-level description of the problem & approach. I have a list containing images and pixel locations in each image - a list of lists. I want to pick n items at random from that list of images and for each image I want to iterate over k random pixel locations. I want to do this in parallel. For each processed pixel, I...

Pthreads vs. OpenMP

I'm creating a multi-threaded application in C using Linux. I'm unsure whether I should use the POSIX thread API or the OpenMP API. What are the pros & cons of using either? Edit: Could someone clarify whether both APIs create kernel-level or user-level threads? ...

avoid race in OpenMP (in a parallel for loop)

I am writing an OpenMP program in C. I have this shared array "data" which is being updated by all threads. i want to ensure that every thread has completed the reading part and stored the value in temp before the next statement data[j] = temp is executed. I tried putting #pragma omp barrier between the two statements but the compiler ...

.gvs (GuideView openmp statictics) file format

Hi Is there a format of *.gvs files, used by GuideView OpenMP performance analyser? The "guide.gvs" is generated, f.e. by intel's OpenMP'ed programmes with $ export LD_PRELOAD=<path_to_icc_or_redist>/lib/libiompprof5.so $ ./openmp_parallelized_prog $ ls -l guide.gvs ...

Why must loop variables be signed in a parallel for?

I'm just learning OpenMP from online tutorials and resources. I want to square a matrix (multiply it with itself) using a parallel for loop. In IBM compiler documentation, I found the requirement that "the iteration variable must be a signed integer." Is this also true in the GCC implementation? Is it specified in the OpenMP standard? If...

Making functions thread safe in C for OpenMP

I have a function which determines if an array needs to be smoothed. I have multiple arrays that this operation needs to be preformed on. I'd like to use the sections construct in OpenMP to do this. Unfortunately, I'm running into segmentation faults as soon as the code grows in an appreciable size. This may be a memory limitation is...

OpenMP parallel on one machine but serial on another

I finally got a section of my code to run in parallel with OpenMP without errors. When I deployed the dll to another machine, however, it no longer ran in parallel. Logging reveals that omp_in_parallel() == 0 on the other machine but not on mine. My machine is using an Intel i5 CPU which has 2 hyperthreaded cores for an effective omp_g...

Fetch-and-add using OpenMP atomic operations

I’m using OpenMP and need to use the fetch-and-add operation. However, OpenMP doesn’t provide an appropriate directive/call. I’d like to preserve maximum portability, hence I don’t want to rely on compiler intrinsics. Rather, I’m searching for a way to harness OpenMP’s atomic operations to implement this but I’ve hit a dead end. Can thi...

OpenMP and shared structures and pointers

I have a function which is passed two structures by reference. These structures are composed of dynamically allocated arrays. Now when I try to implement OpenMP I'm getting a slowdown not a speedup. I'm thinking this can be attributed to possible sharing issues. Here's some of the code for your perusal (C): void leap(MHD *mhd,GRI...

What is easier to learn and debug OpenMP or MPI?

Hi, I have a number crunching C/C++ application. It is basically a main loop for different data sets. We got access to a 100 node cluster with openmp and mpi available. I would like to speedup the application but I am an absolut newbie for both mpi and openmp. I just wonder what is the easiest one to learn and to debug even if the perfo...