Search:

Type: Posts; User: Niels_M

Page 1 of 6 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    8
    Views
    821

    I meant that if I seed every engine uniquely,...

    I meant that if I seed every engine uniquely, then my approach seems correct (?)
  2. Replies
    8
    Views
    821

    Ahh, of course. You are correct, don't know why I...

    Ahh, of course. You are correct, don't know why I didn't realize that.

    Do you agree with my overall structure of the program? I.e., that each thread gets its own engine in order to avoid...
  3. Replies
    8
    Views
    821

    Generating random numbers in parallel

    Hi

    I generate a series of random numbers in parallel (using OpenMP), but depending on what number of threads I invoke, I get a different result. From that I conclude that I have made an error...
  4. Thanks for all the answers and interest.

    Thanks for all the answers and interest.
  5. Is it because it is bad practice, or because it...

    Is it because it is bad practice, or because it simply doesn't work? Personally I can't see why it wouldn't work.

    That being said, I present my approach below, which I believe does exactly as you...
  6. This is my suggestion, using OpenMP (the inner...

    This is my suggestion, using OpenMP (the inner dimension 1 is arbitrarily chosen, I will make it larger as you suggest):


    const int outer = omp_get_max_threads();
    vector<vector<double> >...
  7. First, thanks for all the replies. There are many...

    First, thanks for all the replies. There are many good points, so I will answer them independently.



    You are right, let me tell more about my goal. Here is the most reduced example of my...
  8. I don't understand this. So people like me that...

    I don't understand this. So people like me that are interested in saving their data in between calculations simply wont gain anything from multithreading? Is there really no other container that I...
  9. How to use arrays when vectors are not applicable

    Hi

    I have a loop, which produces somewhere between 1 and 5 million numbers that I need to keep track of. Normally I would store them all in a std::vector, but since my program is multithreaded, I...
  10. Replies
    22
    Views
    10,228

    OK, I'll have to keep working on this.. thanks to...

    OK, I'll have to keep working on this.. thanks to everyone for participating and helping me advance.
  11. Replies
    22
    Views
    10,228

    Ah, I see what you mean. That seems like a good...

    Ah, I see what you mean. That seems like a good approach. It is not stated 100% explicitly, but is this an example of how to achieve your suggestion? If yes, then it is not clear to me, where in that...
  12. Replies
    22
    Views
    10,228

    Thanks, but as far as I have read online, they...

    Thanks, but as far as I have read online, they are not thread safe either? Or have I misunderstood something? It was not entirely clear from the discussion, there are varying opinions.
  13. Replies
    22
    Views
    10,228

    Thanks. So I guess the ultimate solution would be...

    Thanks. So I guess the ultimate solution would be to make one RNG for each thread? Do you know how one could do that?
  14. Replies
    22
    Views
    10,228

    Does anyone know if I would be able to manage...

    Does anyone know if I would be able to manage this, if I switched over to Boost's threading tools?
  15. Replies
    22
    Views
    10,228

    Thanks for your contribution, I have made those...

    Thanks for your contribution, I have made those changes. Even with those optimizations, my program will take a horribly long time to finish. I have the opportunity to run it on a machine with 12...
  16. Replies
    22
    Views
    10,228

    OK, so I tried adding #pragma omp critical...

    OK, so I tried adding



    #pragma omp critical


    which compiles and executes as expected -- but the execution time is similar to that of the unparallelized version. Is there really no other way...
  17. Replies
    22
    Views
    10,228

    I meant is as in #pragma omp parallel...

    I meant is as in




    #pragma omp parallel for private(normal_std_one(engine, nd))
    #pragma omp parallel for private(normal_std_one())
    #pragma omp parallel for private(normal_std_one)
  18. Replies
    22
    Views
    10,228

    Why would that be necessary? I mean, it is just a...

    Why would that be necessary? I mean, it is just a random number generator, would that make any difference?

    Nonetheless, I tried to do what you suggest, but none of the following three versions...
  19. Replies
    22
    Views
    10,228

    I noted it when you posted to begin with, but...

    I noted it when you posted to begin with, but thanks!






    OK, so I guess what I need to do is to

    1) declare velocityX, velocityY, velocityZ, dsdfistanceX, distanceY, distanceZ as private
  20. Replies
    22
    Views
    10,228

    Thanks for the suggestions, both of you. OK, so I...

    Thanks for the suggestions, both of you. OK, so I will simply insert values instead of appending. But I have come across a different problem (but still OpenMP-related), which is when I use an...
  21. Replies
    22
    Views
    10,228

    Using OpenMP and STL vectors

    Hi

    I have a program, where I
    push_back some numbers during a for-loop, as in



    for(int i=0; i<1000000000; i++)
    {
    if(i%10 == 0) num_vec.push_back(i);
  22. Replies
    8
    Views
    910

    Good idea. I would say it looks like this, but I...

    Good idea. I would say it looks like this, but I may be very wrong:



    new_ptr old_ptr new_size Meaning
    ------------------------------------------
    old_ptr NON-NULL non-zero ...
  23. Replies
    8
    Views
    910

    Thanks. So in general the behavior of realloc is...

    Thanks. So in general the behavior of realloc is

    1) The extension is small such that the old block merely increases its size, but doesn't change its location (new_ptr = old_ptr)
    2) The extension...
  24. Replies
    8
    Views
    910

    Problems understanding realloc

    Hi

    I have the following MWE:



    #include <stdio.h>
    #include <stdlib.h>

    int main()
  25. Replies
    1
    Views
    9,423

    Converting argv to float

    Hi

    I have the following minimal non-working example:



    #include <iostream>
    #include <stdlib.h>
    #include <stdio.h>
Results 1 to 25 of 144
Page 1 of 6 1 2 3 4