From: "Joern Loetsch" <jloetsch@stanford.edu>
Subject: NONMEM priority on windows NT/2000
Date: Fri, 4 May 2001 22:53:53 +0200

Dear NONMEM users,
is there a possibility to run NONMEM automatically at low priority under Windows NT/2000? The start /low command gives strange results. In the nmfe5.bat I had replaced "nonem.exe" with "start/ low nonmem.exe" -> didn't work. I want to do that b'cause I've currently got a uniprocessor machine and have to do other work with it while NONMEM runs. I change the priority in the task manager but would like to have that done automatically.

Any suggestions?
Regards
_______________________________________________________
Joern Loetsch, MD, PhD
pharmazentrum frankfurt
Department of Clinical Pharmacology
J.W.Goethe-University Frankfurt/Main
Theodor-Stern-Kai 7
D-60590 Frankfurt/Main, Germany
Phone: +49-69-6301-4589
Fax: +49-69-6301-7636

*****

 

From: "Piotrovskij, Vladimir [JanBe]" <VPIOTROV@janbe.jnj.com>
Subject: RE: NONMEM priority on windows NT/2000
Date: Mon, 7 May 2001 10:16:20 +0200

Joern,
I don't think you need low priority for NONMEM to do parallel tasks under Win2000. I am using a single-processor machine, too, and running NONMEM in parallel with, say, text processing (Word) or graphical exploration (S+) without problems. The only complication I observed until now was that I had to run S+ before executing NONMEM job.

------------------------------------------------------------------------
Vladimir Piotrovsky, Ph.D.
Research Fellow
Global Clinical Pharmacokinetics and Clinical Pharmacology (ext. 5463)
Janssen Research Foundation
B-2340 Beerse
Belgium
Email: vpiotrov@janbe.jnj.com

*****

 

From: "Sale, Mark" <ms93267@GlaxoWellcome.com>
Subject: RE: NONMEM priority on windows NT/2000
Date: Mon, 7 May 2001 08:31:44 -0400

A little complicated but:

You can write another application (in VB or VC) that uses the windows API call createprocess to run the nonmem.exe. This has options including what priority to run at. I currently have this capability embedded in another application that calls NONMEM. While you're at it, you could just replace all of NMFE.bat with an application that did the same this. If there is interest I'd be happy to put this together, it wouldn't take very long.

Mark

*****

 

From: Nick Holford <n.holford@auckland.ac.nz>
Subject: Re: NONMEM priority on windows NT/2000
Date: Tue, 08 May 2001 09:58:20 +1200

Mark,

If you can create a utility (e.g. ntnice) that takes the name of an executable as its command line argument and starts the executable using createprocess with a specified priority this would be very helpful e.g.

ntnice -low nonmem.exe
ntnice -normal nonmem.exe

Users could add this to their own versions of nmfe.bat (or equivalent).

Nick
--
Nick Holford, Divn Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x6730 fax:373-7556
http://www.phm.auckland.ac.nz/Staff/NHolford/nholford.htm

 

*****

 

From: "Banken, Ludger {PDBS~Basel}" <LUDGER.BANKEN@Roche.COM>
Subject: RE: NONMEM priority on windows NT/2000
Date: Tue, 08 May 2001 10:59:47 +0200

Dear NONMEM users,
it is possible and easy to use the start command to set the priority. The start command starts a new DOS box. In this DOS box you have to run nmfe5.bat. I created a new icon with the target
C:\WINNT\system32\CMD.EXE /c start "NONMEM DOS"/LOW /i C:\nonmem\nm5g77\path
This opens a DOS box with low priority. The start command needs a DOS command to be executed. path.bat can be a some dummy command or do necessary changes in the path.

Running NONMEM in low priority reduces the waiting time of other processes. The effect may be more pronounced for Win9x than WinNT. You hardly notice that NONMEM is executing in the background (after compilation phase is finished).

Regards,
Ludger Banken

 

*****

 

From: "Piotrovskij, Vladimir [JanBe]" <VPIOTROV@janbe.jnj.com>
Subject: RE: NONMEM priority on windows NT/2000
Date: Tue, 8 May 2001 14:05:14 +0200

Dear NONMEM users,

I've just tested this method, and it works fine. BTW, you do not need any dummy DOS command; simply type as target
C:\WINNT\system32\CMD.EXE /c start "NONMEM DOS"/LOW /i C:\nmv\run\nmfe5
mod.txt out.txt
and you will have your task (mod.txt) run in low priority.

Best regards,
Vladimir

 

*****

 

From: "Banken, Ludger {PDBS~Basel}" <LUDGER.BANKEN@Roche.COM>
Subject: RE: NONMEM priority on windows NT/2000
Date: Tue, 08 May 2001 14:37:06 +0200

Dear NONMEM users,

without the dummy statement you have to edit the target of your icon each time you want to change the name of your control or output file. But an optimal solution would be to let an additional window pop up to enter the file names. Does anybody has a simple solution?

Best regards,
Ludger Banken

 

*****

 

From: "Sale, Mark" <ms93267@GlaxoWellcome.com>
Subject: RE: NONMEM priority on windows NT/2000
Date: Tue, 8 May 2001 08:39:23 -0400

Nick, Bill, Joern and other nmusers
Could be done, maybe I'll do that tonight. In the meantime, below is last night work, vb (version 6.0) code to run NONMEM. I can't send the executable from GSK (virus protection), but I could send it from a yahoo account it you want it. The executable (low_nm) is placed in c:\nmv\util (or anywhere in the path), then edit the three lines in nmfe5.bat
nonmem.exe
copy output %2
del output

To remark out these and insert low_nm %2

REM nonmem.exe
REM copy output %2
REM del output
low_nm %2

This starts a new DOS window, but returns control to the existing command line (which I think is nice, I don't have to keep opening new DOS windows). The intermediate output appears in the new window, which closes when done and a message box appears telling you that NONMEM is done and in which directory.

Let me know if you want the executable (I promise no viruses)

Mark

Code for low_nm VB6 module
to implement, start a new project, add this as a module and set the start up subroutine to be main. In VB6 you don't need to add any form, (you can delete the one you get by default)

______________________________________________________________________
Private Const wait = 100 ' msec wait for waitforsingle object
Private Const CREATE_NEW_CONSOLE = &H10
Private Const NORMAL_PRIORITY_CLASS = &H20
Private Const IDLE_PRIORITY_CLASS = &H40
Private Const HIGH_PRIORITY_CLASS = &H80
Private Const REALTIME_PRIORITY_CLASS = &H100
Private Const CREATE_NEW_PROCESS_GROUP = &H200
Private Const CREATE_NO_WINDOW = &H8000000
Private Const USESHOWWINDOW = 1
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNOACTIVATE = 4
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
Private Const SW_SHOWNA = 8
Private Const SW_RESTORE = 9
Private Const SW_SHOWDEFAULT = 10
' the process information for createprocess
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
'
'The STARTUPINFO structure allows the CreateProcess function to control many aspects of the creation process. This structure is described in Appendix B.

Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
' used to run nonmem
Private Declare Function CreateProcessBynum Lib "kernel32" Alias
"CreateProcessA" _
(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment
As Any, _
ByVal lpCurrentDirectory As String, lpStartupInfo As STARTUPINFO, _
lpProcessInformation As PROCESS_INFORMATION) As Long
' used in loop to see when it is done
Private Declare Function WaitForSingleObject& Lib "kernel32" (ByVal hHandle
As Long, _
ByVal dwMilliseconds As Long)
' used to clean up memory when done
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long
Sub Main()
Dim res As Long ' just a return value
Dim rval As Long ' also a return value
Dim proc_hand As Long ' handle to nonmem process
Dim nm_dir As String, output_file As String
On Error GoTo call_nm_error ' basic error handler
nm_dir = CurDir ' to make sure we end up in the same directory as we started

Dim sinfo As STARTUPINFO, pinfo As PROCESS_INFORMATION
sinfo.cb = Len(sinfo)
sinfo.lpReserved = vbNullString
sinfo.lpDesktop = vbNullString
sinfo.lpTitle = "NONMEM run window"
sinfo.dwFlags = USESHOWWINDOW
' sinfo.wShowWindow = SW_HIDE

sinfo.wShowWindow = SW_SHOWNORMAL
' run nonmem
res = CreateProcessBynum("nonmem.exe", vbNullString, 0, 0, _
True, IDLE_PRIORITY_CLASS, ByVal 0&, vbNullString, _
sinfo, pinfo)
' get the process handle
proc_hand = pinfo.hProcess

rval = 200 ' = 258 IF PROCESS STILL RUNNING
While rval > 1
' see if it is done yet
rval = WaitForSingleObject(proc_hand, wait)
Wend 'need new process, set missing_proc 258 is still running
' clean up memory
Call CloseHandle(pinfo.hProcess)
Call CloseHandle(pinfo.hThread)
' output file is command line argument
output_file = Command()
' copy to user specified output file %2 in nmfe5.bat
FileCopy "output", output_file
If Dir(nm_dir & "\output") <> "" Then ' check to see if "output" is present
Kill "output" ' if so, delete it
End If
ChDir nm_dir ' change back to original directory
MsgBox "Done with NONMEM in " & nm_dir
End

call_nm_error: ' basic error handeling, actually doesn't do anything.
MsgBox "Error in Call_nm"
On Error GoTo 0

End Sub

*****

 

From: "Bachman, William" <bachmanw@globomax.com>
Subject: RE: NONMEM priority on windows NT/2000
Date: Tue, 8 May 2001 12:01:09 -0400

Kudos to Ludger for a simple solution!

I haven't tried this with Win 2000 yet, but with NT, I omitted the dummy command "path" and everything that is run in that window when run is low priority. The "target" for the DOS icon was simply:

C:\WINNT\system32\CMD.EXE /c start "NONMEM DOS"/LOW /i

So you need not create a dummy batch file. You could create a batch file, e.g. nmbatch.bat, with numerous runs in it and run all day (or all week) in low priority. The contents of nmbatch.bat might look like:

call nmfe5 101.ctl 101.res
call nmfe5 102.ctl 102.res
call nmfe5 103.ctl 103.res
call nmfe5 104.ctl 104.res

Bill

 

*****

 

From: Nick Holford <n.holford@auckland.ac.nz>
Subject: Re: NONMEM priority on windows NT/2000
Date: Wed, 09 May 2001 07:59:17 +1200

"Bachman, William" wrote:
>
> I haven't tried this with Win 2000 yet, but with NT, I omitted the dummy
> command "path" and everything that is run in that window when run is low
> priority. The "target" for the DOS icon was simply:
>
> C:\WINNT\system32\CMD.EXE /c start "NONMEM DOS"/LOW /i

I've confirmed it works under Win2000. Also note it is more general to use
%comspec% /c start "NONMEM DOS"/LOW /i
The %compspec% is an environment variable that points to CMD.EXE wherever it happens to live on your system.

You can also use these options under Win2000 (I dont think abovenormal exists for Win NT).
%comspec% /c start "NONMEM DOS"/high /i
%comspec% /c start "NONMEM DOS"/abovenormal /i
%comspec% /c start "NONMEM DOS"/realtime /i
%comspec% /c start "NONMEM DOS"/normal /i

> So you need not create a dummy batch file. You could create a batch file,
> e.g. nmbatch.bat, with numerous runs in it and run all day (or all week) in
> low priority. The contents of nmbatch.bat might look like:
>
> call nmfe5 101.ctl 101.res
> call nmfe5 102.ctl 102.res
> call nmfe5 103.ctl 103.res
> call nmfe5 104.ctl 104.res

If you get tired of having to repeat the runname every time you use nmfe some simple surgery on nmfe.bat will let you use

call nmfe5betta 101

In your nmbatch.bat file you can write:

for %%c in (101 102 103 104) do call nmfe5 %%c.ctl %%c.res

or

for %%c in (101 102 103 104) do call nmfe5betta %%c

[and for a real change you could try using Wings for NONMEM which works like nmbetta with a command called nmgo. See http://www.geocities.com/wfn2k. Version 222 supports the g77 compiler and the randomization test.]

--
Nick Holford, Divn Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x6730 fax:373-7556
http://www.phm.auckland.ac.nz/Staff/NHolford/nholford.htm