OpenMP question

This is a discussion on OpenMP question within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm an amateur programmer who started using OpenMP recently. I was wondering if what I'm doing is fine. I ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    2

    OpenMP question

    Hi,

    I'm an amateur programmer who started using OpenMP recently. I was wondering if what I'm doing is fine. I attached a code. The problem is that I have a static array of length 8 (called val and weight) which I would like to use as a private variable in the loop I'm parallelizing. Is that legitimate?

    Also I accumulate on variables sum and weight at the very end, would this work correctly? (Parallelization is for the outermost loop, that's why I do not use reduction.)

    I keep getting wrong mathematical results and I was wondering if my code contains a bug.

    Thank you very much for your input.
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 03:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 06:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 01:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21