10000 The grape6 interface offers a rather primitive method for sharing the GRAPE-6 hardware by several programs running simultaneously. A program acquires GRAPE-6 by calling g6_open. If someone is already using GRAPE-6, g6_open prints some message and put the process into the sleep state. When the hardware is released, the process is waken up and g6_open returns. A program can release GRAPE-6 by calling g6_close. Thus, a program occupies GRAPE-6 hardware between the calls to g6_open and g6_close.
In order to attain the sharing of GRAPE-6 between multiple users, therefore, programmers must write their program so that it releases GRAPE-6 at an reasonable time interval, which is around 1 minutes.
Note: Currently, this function is implemented only on X86 platforms.
In comuter centers with many users, it might be more appropriate to have more strict control on the allocation of resources to jobs submitted by different users. In order to achieve this, the administrator can set soft limit and hard limit for the CPU time for which application programs occupy GRAPE-6 hardware.
The soft limit is specified by adding the following line to the configuration file
TIMESOFTLIMIT xxxHere, xxx is the soft limit in unit of seconds. For example,
TIMESOFTLIMIT 300sets the soft limit to 300 seconds. The soft limit works in the following principle.
If the time one program occupied GRAPE-6 exceeded the soft limit, the excess time is recorded in the library when g6_close is called. When g6_open is called next time, if someone else is using the GRAPE-6 hardware, the process which calls g6_open is put to the sleep state for the recorded excess time. If no one else is using the GRAPE-6 hardware, the process is not put to the sleep state.
The hard limit is specified by adding the following line to the configuration file.
TIMEHARDLIMIT xxxHere, xxx is the hard limit in unit of seconds. For example,
TIMEHARDLIMIT 1000sets the hard limit to 1000 seconds.The hard limit works in the following principle.
First, the function g6calc_lasthalf periodically checks the CPU time, and if the hard limit is exceeded, it returns the error status. If error status is detected, application program must release and reinitialize GRAPE-6, since this error should be treated in the same way as the hardware error.
Second, if the program does not release the GRAPE-6 hardware even after this error is forced, g6calc_lasthalf will call exit(-1) when CPU time reachs twice the hard limit.
Defaults for these limits are some large numbers.