- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
i want to use openMP directives to multiply a sparse matrix to a vector.
here is a part of the code that i want to parallelize:
int count=0;
#pragma omp parallel for
for(int a=0; a {
count=I[a+1]-I+count;//count to count the number of nnz in every row.
while(index!=count)
{
k=k+A[index]*B[J[index]];// to add the multiplications of every nnz in the row by the vector
index++;
}
solution=k;//fill the value of K of every row in the array solution[]
k=0;
}
i have followed these steps in my C++ project:
-include the openMP library: #include
-set project as startup
-parallel compose->use intel C++...
then run the code.
all what i'm getting is:
-cores count:2
-threads created:1
i have copied my code, past it in the wmandelbrot project, and f...
i want to use openMP directives to multiply a sparse matrix to a vector.
here is a part of the code that i want to parallelize:
int count=0;
#pragma omp parallel for
for(int a=0; a {
count=I[a+1]-I+count;//count to count the number of nnz in every row.
while(index!=count)
{
k=k+A[index]*B[J[index]];// to add the multiplications of every nnz in the row by the vector
index++;
}
solution=k;//fill the value of K of every row in the array solution[]
k=0;
}
i have followed these steps in my C++ project:
-include the openMP library: #include
-set project as startup
-parallel compose->use intel C++...
then run the code.
all what i'm getting is:
-cores count:2
-threads created:1
i have copied my code, past it in the wmandelbrot project, and f...
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you use MS Visual Studio go to Project Properties->C/C++->Language->OpenMP Support. Enable it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lots of shared variables in your code. You should make them private using private(...) options. The general rule is as follows: any variable that is stored in the code should be private unless it is a reduction variable or you use critical section to protect it from the concurrent access.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10X for the info, finally it worked :D
i've got this:
threads created: 2 :D
thank you for ur help
as for the shared variables, some readings are waiting for me, i hope i'll be able to figure it alone :)
but this rule surely will help me, thank u again :)
sorry for bothering :)
i've got this:
threads created: 2 :D
thank you for ur help
as for the shared variables, some readings are waiting for me, i hope i'll be able to figure it alone :)
but this rule surely will help me, thank u again :)
sorry for bothering :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks and nice to know that it worked (per Mikhail's suggestion!)...
-Cheers,
Kittur
-Cheers,
Kittur

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page