Skip to content

Use a more robust check for process completion#1

Open
lbeltrame wants to merge 1 commit into
markowetzlab:mainfrom
DIncalciLab:better-pid-detection
Open

Use a more robust check for process completion#1
lbeltrame wants to merge 1 commit into
markowetzlab:mainfrom
DIncalciLab:better-pid-detection

Conversation

@lbeltrame
Copy link
Copy Markdown

The approach used in the script assumes that the GPU is exclusively used
by the invoker. However, some places (like mine) treat GPUs as shared
resources: different users can use the same GPU. Therefore, the single
presence of a process called pythonin the process list, even if not created
by the caller, will cause the script to loop needlessly without doing anything.

This change creates an array where the PIDs for each of the calculations
are stored (using $!), then uses wait to ensure that all the processes have
ended before moving on to the next iteration.

Note: This adds a dependency on bash (but I'm not sure if this
script is POSIX-compatible) and requires a reasonably recent version of
it (tested with 5.0 on Debian).

The approach used in the script assumes that the GPU is exclusively used
by the invoker. However, some places (like mine) treat GPUs as shared
resources. Therefore, the single presence of a process called `python`
in the process list, even if not created by the caller, will cause the
script to loop needlessly.

This change creates an array where the PIDs for each of the calculations
are stored, then uses `wait` to ensure that all the processes have ended
before moving to the next iteration.

**Note**: This adds a dependency on bash (but I'm not sure if this
script is POSIX-compatible) and requires a reasonably recent version of
it (tested with 5.0 on Debian).
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

Successfully merging this pull request may close these issues.

1 participant