Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem to implement multithreaded Grappa #284

Open
buaasun opened this issue Jun 13, 2016 · 1 comment
Open

problem to implement multithreaded Grappa #284

buaasun opened this issue Jun 13, 2016 · 1 comment

Comments

@buaasun
Copy link

buaasun commented Jun 13, 2016

I have try to change the implementation of Grappa to be multithreaded, but I encountered some problems. Could you give me some help?
I mainly modify the code in this commit buaasun@02c397b

When I run the modified version of helloworld, sometimes it can finish all tasks, but sometimes it failed randomly. I guess the problem is in swap_context.
However, it is difficult to debug the problem, because the call stack is broken when the problem happen. I find nothing in gdb backtrace. I have no idea to solve the problem, so I really need your help @bmyerz @nelsonje

BTW. I found a similar project https://github.com/Qthreads/qthreads. It is multithreaded. So I think it should be no problem to change Grappa to be multithreaded.

@nelsonje
Copy link
Member

Look, I don't want to be offensive, but this is a bad idea, you're unlikely to succeed, and I don't know what you would get from it that Grappa doesn't already provide.

Grappa is based on a process-per-core model. We run our own lightweight threads within each process, but all bound to a single core. This allows the scheduler and the communication layer to make many assumptions about the state of caches, about the replication of private per-core data structrues, and about the atomicity of execution of various routines. The Grappa code assumes this process-per-core property is true in dozens, if not hundreds, of places. Changing to a multithreaded model would a huge number of changes to some very tricky pieces of code. It's certainly possible, but it would be super-hard and take a very long time, even for me.

The last time you asked us a question, it sounded like you were having trouble running jobs that made use of multiple cores on each node. You do not need to add threading to Grappa to do this; it is already supported, and is how we collected all the data in our papers.

If you want to run on a cluster with multicore machines, you simply run multiple processes per node using your MPI job launcher. Those processes will find each other using MPI, and allocate shared memory regions for faster inter-core communication within a node, all automatically (assuming your MPI implementation is configured correctly). Then you just have to expose parallelism using Grappa's APIs, and work will be spread across all the cores on all the nodes in your jobs. There are lots of examples of this in the /applications directory.

What is it that you're trying to accomplish with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants