[gmx-users] Limit mdrun runtime

Jack Shultz js at drugdiscoveryathome.com
Mon Sep 14 18:04:41 CEST 2009


I think I found a sample code that does this actually

my $timeout = 180;
my $pid = fork;

if ( defined $pid ) {
    if ( $pid ) {
        # this is the parent process
        local $SIG{ALRM} = sub { die "TIMEOUT" };
        alarm 180;
        # wait until child returns or timeout occurs
        eval {
            waitpid( $pid, 0 );
        };
        alarm 0;

        if ( $@ && $@ =~ m/TIMEOUT/ ) {
            # timeout, kill the child process
            kill 9, $pid;
        }
    }
    else {
        # this is the child process
        # this call will never return. Note the use of exec instead of system
        exec "simulator --shell";
    }
}
else {
    die "Could not fork.";
}


On Mon, Sep 14, 2009 at 11:56 AM, Jack Shultz
<js at drugdiscoveryathome.com> wrote:
>
> So if I do this within a perl script, I will need to capture the pid and kill that process if it runs over 5 minutes? I'll try the -maxh first. Otherwise I'll spend some time trying to debug it.
>
> On Mon, Sep 14, 2009 at 11:09 AM, Berk Hess <gmx3 at hotmail.com> wrote:
>>
>> If mdrun hangs -maxh won't help.
>> You can kill mdrun using the kill command.
>> But since mdrun catches signals, you might need kill -9 (the 'KILL' signal).
>>
>> Berk
>>
>> > Date: Mon, 14 Sep 2009 10:56:43 -0400
>> > From: jalemkul at vt.edu
>> > To: gmx-users at gromacs.org
>> > Subject: Re: [gmx-users] Limit mdrun runtime
>> >
>> >
>> >
>> > Jack Shultz wrote:
>> > > Hello,
>> > >
>> > > I have developed a workflow for prepping structures. One problem I have
>> > > is sometimes it gets hung up on mdrun. Are there any mdrun parameters we
>> > > can use to kill this process if it runs too long? The parameters we are
>> > > using should not run over 5 minutes. I have not figured out how to do
>> > > this with my script, but I guess there may be a way using SIGALRM.
>> > >
>> >
>> > mdrun -maxh
>> >
>> > -Justin
>> >
>> > > --
>> > > Jack
>> > >
>> > > http://drugdiscoveryathome.com
>> > > http://hydrogenathome.org
>> > >
>> > >
>> > > ------------------------------------------------------------------------
>> > >
>> > > _______________________________________________
>> > > gmx-users mailing list gmx-users at gromacs.org
>> > > http://lists.gromacs.org/mailman/listinfo/gmx-users
>> > > Please search the archive at http://www.gromacs.org/search before posting!
>> > > Please don't post (un)subscribe requests to the list. Use the
>> > > www interface or send it to gmx-users-request at gromacs.org.
>> > > Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>> >
>> > --
>> > ========================================
>> >
>> > Justin A. Lemkul
>> > Ph.D. Candidate
>> > ICTAS Doctoral Scholar
>> > Department of Biochemistry
>> > Virginia Tech
>> > Blacksburg, VA
>> > jalemkul[at]vt.edu | (540) 231-9080
>> > http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin
>> >
>> > ========================================
>> > _______________________________________________
>> > gmx-users mailing list gmx-users at gromacs.org
>> > http://lists.gromacs.org/mailman/listinfo/gmx-users
>> > Please search the archive at http://www.gromacs.org/search before posting!
>> > Please don't post (un)subscribe requests to the list. Use the
>> > www interface or send it to gmx-users-request at gromacs.org.
>> > Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>>
>> ________________________________
>> Express yourself instantly with MSN Messenger! MSN Messenger
>> _______________________________________________
>> gmx-users mailing list    gmx-users at gromacs.org
>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>> Please search the archive at http://www.gromacs.org/search before posting!
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-users-request at gromacs.org.
>> Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>
>
>
> --
> Jack
>
> http://drugdiscoveryathome.com
> http://hydrogenathome.org



--
Jack

http://drugdiscoveryathome.com
http://hydrogenathome.org



More information about the gromacs.org_gmx-users mailing list