Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:52:13+00:00 2026-05-24T07:52:13+00:00

here is the parallel(verbatim) version of matrix to vector multiplication as implemented in this

  • 0

here is the parallel(verbatim) version of matrix to vector multiplication as implemented in this book

using OpenMP

subroutine matvecmul(mat,vec,res,m,n)
use omp_lib
implicit none
integer::m,n,i,j
real*8,dimension(m,n),intent(in)::mat
real*8,dimension(n),intent(in)::vec
real*8,dimension(m)::res 
res(:)=0.0
 !$omp parallel do default(none)
 !$omp shared(mat,vec,res,m,n) private(i,j)
  do i=1,m
   do j=1,n
    res(i)=res(i)+mat(i,j)*vec(j)
   end do
  end do
 !$omp end parallel do
 return
end subroutine matvecmul

i get this syntax error “unclassified openMP clause shared”,”unclassified openMP clause private”
compiled with gfortran 4.4.5 and gfortran 4.6.0

is the shared clause deleted/depcrecated or not implemented in “gomp” or i made some foolish mistake or errata of book …
with default(one) i didn’t get any syntaxerror how am i supposed to say which vars are private and which to be shared ?

here is how i implemented without errors (and correct)

subroutine matvecmul(mat,vec,res,m,n)
use omp_lib
implicit none
integer::m,n,i,j
real*8,dimension(m,n),intent(in)::mat
real*8,dimension(n),intent(in)::vec
real*8,dimension(m)::res
res(:)=0.0
 !$omp parallel do private(i,j)
  do i=1,m
   do j=1,n
    res(i)=res(i)+mat(i,j)*vec(j)
   end do
  end do
 !$omp end parallel do
return
end subroutine matvecmul

i’m still a newbie to openmp (but i need to learn it fast… part of my job!)
some explaination here would be appreciated..
is there any openMP tutorial only using gomp (say gcc/gfortran 4.4.5)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:52:14+00:00Added an answer on May 24, 2026 at 7:52 am

    This doesn’t have anything to do with gcc’s implementation of OpenMP; intel fortran refuses to compile this, too. This is just about how lines are continued in OpenMP + Fortran.

    What you want to do, which is entirely correct, is:

    !$omp parallel do default(none) shared(mat,vec,res,m,n) private(i,j)
    

    I heartily endorse the approach of using default none and explicitly specifying shared and private variables as best practice. If you use the line above, your routine will compile

    The code brok this up into multiple lines, for clarity; and there’s nothing wrong with that except the syntax is that, like with other modern Fortran continuation lines, you need an ampersand at the end of the continued line:

     !$omp parallel do default(none)  &
     !$omp shared(mat,vec,res,m,n) private(i,j)
    

    Presumably this was a typo in the book. Because OpenMP is a standard, there’s no special gomp (or iomp) version of OpenMP. A compliant OpenMP program should compile on any compliant compiler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please help me to make this code parallel using openmp this code is run
Yesterday I asked a question about parallel matrix multiplication in Java 7 using the
This article here suggests to use -XX:+UseParNewGC To enable a parallel young generation GC
I have implemented a simple parallel merge sort algorithm in Java. This cuts the
I'm writing a parallel program using open mp in which I generate a matrix
I'm trying to run some commands in paralel, in background, using bash. Here's what
Here is my code, which takes two version identifiers in the form 1, 5,
Here's a coding problem for those that like this kind of thing. Let's see
Here is the context. I want to have a free version and a premium
Okay, so here is the basic background. This program connects to outlook/exchange and parses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.