[gmx-developers] dup_tfn in src/kernel/runner.c
Sander Pronk
pronk at cbr.su.se
Tue Aug 3 09:07:45 CEST 2010
Hi Mark,
Actually, the two copies are needed: the first one copies the tfn to a static intermediate, so that the main thread can go on in mdrunner(). The second copy happens for each thread and copies this static intermediate for each spawned thread's own use.
If the first copy wouldn't be made, the main thread, which continues as soon as other threads are spawned, would change data in the tfn while other threads were copying it. This actually lead to crashes and it took me some time to recognize at the time.
I'll add some comments in the relevant code with my next commit.
Sander
On Aug 3, 2010, at 07:36 , Mark Abraham wrote:
> Hi,
>
> I noticed in git master src/kernel/runner.c that dup_tfn is called twice during thread invocation, once by mdrunner_start_threads before the spawn, and then again by mdrunner_start_fn after the spawn. That seems like overkill. I think the latter suffices for each thread to get its own local copy of the filename data, so the former is unecessary. I'm no expert on threads, however...
>
> Might this be an artefact of the thread reorganization a month or two back?
>
> Cheers,
>
> Mark --
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
More information about the gromacs.org_gmx-developers
mailing list