[Omp] can any one help me in this..
Garimella Pradeep Kumar
coolhalmstad at gmail.com
Fri Nov 24 10:46:45 PST 2006
Hello,
I am new to programming in OpenMp.I have written OpenMp code in c++.I am
running it on sunfire v880 contains 6 processors using cc compiler.
topin%CC -xopenmp -o program.cpp????
Is this is correct.Is that the flag given is correct
But when I am compiling.I am getting only one warning i.e. optimization
level changed from o to 3 to support parallelized code.
when I am running the code I am getting same processor utilization code as
for 1 processor and for 6 processor.How can i know wheather the threads are
parallelized or not.
If any one can help me in that please reply me back.please tell me how to
write the open mp code for this for loops.before the for loops is any
initializations r important.
here is my code
#include<omp.h>
#include<stdlib.h>
#include<stdio.h>
int main();
//some statements
for (unsigned int it=0;it < iterations;++it)
{
std::cout << "Iteration: " << it << std::endl;
for (unsigned int out_row = 0; out_row < rows;++out_row)
{
float row_index_dec = float(out_row);
float col_index_dec = 0.0;
for (unsigned int out_col = 0;out_col < cols;++out_col)
{
swtich case:
// some cases
//some statements
}
}
}
On 11/16/06, omp-request at openmp.org <omp-request at openmp.org> wrote:
>
> Send Omp mailing list submissions to
> omp at openmp.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://openmp.org/mailman/listinfo/omp
> or, via email, send a message with subject or body 'help' to
> omp-request at openmp.org
>
> You can reach the person managing the list at
> omp-owner at openmp.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Omp digest..."
>
>
> Today's Topics:
>
> 1. availability of data structures in subroutines executed in
> parallel (Daniel Franke)
> 2. Re: availability of data structures in subroutines executed
> in parallel (Greg Bronevetsky)
> 3. C do-while loops in openmp (kees)
> 4. OpenMP 3.0 (Tobias Burnus)
> 5. RE: C do-while loops in openmp (Tian, Xinmin)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 16 Nov 2006 12:48:30 +0100
> From: "Daniel Franke" <franke.daniel at gmail.com>
> Subject: [Omp] availability of data structures in subroutines executed
> in parallel
> To: omp at openmp.org
> Message-ID:
> <640ad44b0611160348q727e38c1iac5e39906f2c7789 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Dear all,
>
> this may be a stupid question, but I am out of my wits here.
> In a subroutine, I have something similar to this
>
> DO
> !$OMP PARALLEL SHARED(graph)
> ! select a startnode from graph
> CALL graph_algorithm(startnode)
> !$OMP END PARALLEL
> ! alter the graph, check exit conditions
> END DO
>
> where GRAPH is a node type that holds an array of pointers to
> neighbouring nodes, each of those holds an array of pointers to
> neighbouring nodes ...
>
> Now, while GRAPH_ALGORITHM works fine if compiled without OMP support
> or if OMP_NUM_THREADS=1 (gfortran-4.2.-prerelease), it crashes at
> various places if executed in parallel. The algorithm is a
> depth-first-search within a subset of the nodes, beginning at
> STARTNODE. The nodes themselves are not altered during the process,
> everything is read-only.
>
> >From debugging I already learned, that some (all?) of the pointers
> building the graph become undefined when GRAPH_ALGORITHM is executed
> in parallel -- although the GRAPH is explicitely SHARED?! I read the
> specs back and forth and can not conclude anything helpful from it.
>
> It is to assume that I miss something important here.
> A hint or pointer would what this might be would really be appreciated.
>
> Thanks and regards
> Daniel
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 16 Nov 2006 09:42:54 -0500 (EST)
> From: Greg Bronevetsky <greg at bronevetsky.com>
> Subject: Re: [Omp] availability of data structures in subroutines
> executed in parallel
> To: Daniel Franke <franke.daniel at gmail.com>
> Cc: omp at openmp.org
> Message-ID:
> <Pine.BSF.4.21.0611160936110.19634-100000 at bijisan.lojik.net>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> Can you provide more details about how you created the graph and how
> you use it? If the graph was created outside the omp parallel region, it
> is very likely to be shared by default, so your SHARED clause is probably
> not doing anything. Furthermore, SHARED applies to the graph variable
> itself and not anything that it refers to so unless the entire graph is
> contained inside this variable, the SHARED clause is again not doing much.
> Thus, it seems likely that the crashes are due to your threads accessing
> graph nodes inside the parallel region without proper synchronization.
>
> Greg Bronevetsky
>
> On Thu, 16 Nov 2006, Daniel Franke wrote:
>
> > Dear all,
> >
> > this may be a stupid question, but I am out of my wits here.
> > In a subroutine, I have something similar to this
> >
> > DO
> > !$OMP PARALLEL SHARED(graph)
> > ! select a startnode from graph
> > CALL graph_algorithm(startnode)
> > !$OMP END PARALLEL
> > ! alter the graph, check exit conditions
> > END DO
> >
> > where GRAPH is a node type that holds an array of pointers to
> > neighbouring nodes, each of those holds an array of pointers to
> > neighbouring nodes ...
> >
> > Now, while GRAPH_ALGORITHM works fine if compiled without OMP support
> > or if OMP_NUM_THREADS=1 (gfortran-4.2.-prerelease), it crashes at
> > various places if executed in parallel. The algorithm is a
> > depth-first-search within a subset of the nodes, beginning at
> > STARTNODE. The nodes themselves are not altered during the process,
> > everything is read-only.
> >
> > >From debugging I already learned, that some (all?) of the pointers
> > building the graph become undefined when GRAPH_ALGORITHM is executed
> > in parallel -- although the GRAPH is explicitely SHARED?! I read the
> > specs back and forth and can not conclude anything helpful from it.
> >
> > It is to assume that I miss something important here.
> > A hint or pointer would what this might be would really be appreciated.
> >
> > Thanks and regards
> > Daniel
> > _______________________________________________
> > Omp mailing list
> > Omp at openmp.org
> > http://openmp.org/mailman/listinfo/omp
> >
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 13 Nov 2006 21:25:06 +0000
> From: kees <omekeesje at wanadoo.nl>
> Subject: [Omp] C do-while loops in openmp
> To: omp at openmp.org
> Message-ID: <4558E2B2.9080600 at wanadoo.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello everybody,
> I am just beginning to program (or better, to change some existing
> programs) using
> openmp parallelization in C.
> As far as for-loops are concerned, this gives me no problems.
> But the kind of the programs I aim to parallelize is such that they
> involve a lot of (big)
> do-while or while-do loops and far less for loops.
> So to reap the real benefits of parellel-processing, I absolutely have
> to parallelize
> those do-while/while-do loops.
> On reading the documentation of openmp, I came to the conclusion (I hope
> you
> can put me wrong) that this is only possible by changing the total
> structure of
> my programs and somehow not using those loops anymore, which is is about
> the same as a complete rewriting, and in this case, out of the question.
> Now I come to my questions:
> Is there an elegant and concise way to parallelize C while-do/do-while
> loops?
> Can anybody give me a hint how this is to be done?
> Greetings,
> Kees de jong
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 15 Nov 2006 20:35:10 +0100
> From: Tobias Burnus <burnus at net-b.de>
> Subject: [Omp] OpenMP 3.0
> To: omp at openmp.org
> Message-ID: <455B6BEE.3000804 at net-b.de>
> Content-Type: text/plain; charset=ISO-8859-15
>
> Hi all,
>
> I'd like to know what is the status about OpenMP 3.0. I somewhere read
> that it would be shown at the SC06 and the specs would be released soon
> after. I see (http://www.openmp.org/pipermail/omp/2006/000557.html) that
> the OpenMP BOF at SC06 contains
> "Overview of OpenMP 3.0 Features" (Nov. 17, i.e. in two days).
>
> Will the slides made available for those who cannot attend?
>
> Tobias
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 16 Nov 2006 09:41:29 -0800
> From: "Tian, Xinmin" <xinmin.tian at intel.com>
> Subject: RE: [Omp] C do-while loops in openmp
> To: "kees" <omekeesje at wanadoo.nl>, <omp at openmp.org>
> Message-ID:
> <
> A29F7A5700A7EA4380E08C1F68C3B6D8C8AB8F at scsmsx411.amr.corp.intel.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Have you tried Intel's Taskqueuing (workqueuing) Model and Intel
> compiler to parallelize c-do-while loop?
>
> Xinmin Tian (Intel)
>
> -----Original Message-----
> From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
> Of kees
> Sent: Monday, November 13, 2006 1:25 PM
> To: omp at openmp.org
> Subject: [Omp] C do-while loops in openmp
>
> Hello everybody,
> I am just beginning to program (or better, to change some existing
> programs) using
> openmp parallelization in C.
> As far as for-loops are concerned, this gives me no problems.
> But the kind of the programs I aim to parallelize is such that they
> involve a lot of (big)
> do-while or while-do loops and far less for loops.
> So to reap the real benefits of parellel-processing, I absolutely have
> to parallelize
> those do-while/while-do loops.
> On reading the documentation of openmp, I came to the conclusion (I hope
> you
> can put me wrong) that this is only possible by changing the total
> structure of
> my programs and somehow not using those loops anymore, which is is about
> the same as a complete rewriting, and in this case, out of the question.
> Now I come to my questions:
> Is there an elegant and concise way to parallelize C while-do/do-while
> loops?
> Can anybody give me a hint how this is to be done?
> Greetings,
> Kees de jong
>
>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp
>
>
> ------------------------------
>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp
>
>
> End of Omp Digest, Vol 35, Issue 2
> **********************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openmp.org/pipermail/omp/attachments/20061124/2fa1eda0/attachment.html
More information about the Omp
mailing list