Giter VIP home page Giter VIP logo

Comments (6)

caitlinross avatar caitlinross commented on August 26, 2024 2

Neil is correct that you won't be able to send anything referenced by pointers through an event to another PE, without having someway to handle it.

I think your RNG approach sounds like it's probably the way to go in this case. And I agree with Neil that you'll want multiple RNGs for each LP, with one being dedicated to your usual RNG use, and one for just producing this same sequence of integers on each LP. He's also right that you can use the default ROSS generated seed for one and for the other, use the identical seed on all LPs.

So the basic idea of what you'll want to do in code:

g_tw_nRNG_per_lp++;  // default is 1

tw_define_lps(<whatever you usually pass in here>);

for (tw_lpid id = 0; id < g_tw_nlp; id++)
{
    // so rng[0] would keep the default ROSS seed
    // rng[1] would be the one that is the same on each LP
    tw_rand_initial_seed(&g_tw_lp[id]->rng[1], <seed>);
}

And that should be all you need!

from ross.

ecamiloinacio avatar ecamiloinacio commented on August 26, 2024 2

This alternative worked just fine. Thanks!

from ross.

nmcglo avatar nmcglo commented on August 26, 2024

You are correct, dynamic memory pointers are not dereferenced when they are shared between PEs. You'll have to write your own serializer and deserializers to pack and unpack into a static-memory byte array in the event struct. These have to be made for any dynamic memory in your event structs and said functions will have to be called at every event handler. It's better to entirely avoid dynamic memory in events. @caitlinross might have more insight about this and alternatives.

from ross.

ecamiloinacio avatar ecamiloinacio commented on August 26, 2024

I understand. Assuming that exchanging event messages with a pointer array between LPs in different PEs is not an option, is it possible to enforce that LPs (of the same type) in different PEs produce the same sequence of integers in RNG functions such as tw_rand_integer()?

In case this is possible, I can have the specific LP that returns event messages with pointer array in the same PE as the requester, and my problem would be solved.

from ross.

nmcglo avatar nmcglo commented on August 26, 2024

I think it should be possible to do that. You'll need to utilize multiple RNGs in each LP - as you wouldn't want to force every LP's main RNG to have the same seed.

What I'm imagining is that each LP would have two RNGs, one default one with a ROSS generated seed and one separate RNG with an identical seed as all other LPs used for your workaround. How exactly this would be done is not something I'm very familiar with.

Might consider checking out this page from the wiki on the topic

I'll check with others in the research group tomorrow about this.

from ross.

nmcglo avatar nmcglo commented on August 26, 2024

Happy to hear it!

from ross.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.