-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path!bench.cmd
81 lines (65 loc) · 2.01 KB
/
!bench.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@echo off
setlocal enableextensions
setlocal disabledelayedexpansion
echo *************************************************************** 2016.12.19 **
echo * DLS9 enumerator - Optimized MPI version of the DLS enumeration application
echo *
echo * !bench.cmd : CMD benchmarking script
echo *
echo *****************************************************************************
echo * Copyright (c) 2016 by Alexander M. Albertian, ^<assa@4ip.ru^>.
echo *
echo * Usage:
echo * !bench.cmd [^<minimal-number-of-ranks^> [^<maximal-number-of-ranks^>]]
echo *****************************************************************************
echo.
set "EXE=..\x64\Release\dls9.exe"
set "DATA=dls9_count_data"
set "NBENCH=2"
for %%i in ( "%EXE%" "%DATA%" ) do (
if not exist "%%~dpnxi" (
set err_msg=File "%%~dpnxi" doesn't exist
goto error
)
)
set MPIEXEC=
for /f "tokens=* delims=" %%f in ( '"%SystemRoot%\system32\where.exe" mpiexec.exe' ) do (
set "MPIEXEC=%%~dpnxf"
goto mpiok
)
:mpiok
set "err_msg=Can't find mpiexec.exe"
if not exist "%MPIEXEC%" goto error
echo.MPIEXEC : "%MPIEXEC%" >&2
set START=1
set STEP=1
set /a "NPROC=%~1" 2>nul
set /a "STOP=%~2" 2>nul
if not "%NPROC%"=="" set /a "START=%NPROC%" 2>nul
set /a "START+=1"
set "err_msg=NUMBER_OF_PROCESSORS environment variable isn't set"
if "%STOP%"=="" (
if "%NUMBER_OF_PROCESSORS%"=="" goto error
set /a "STOP=%NUMBER_OF_PROCESSORS%*3/2"
)
set /a "STOP+=1"
echo. START = %START% >&2
echo. STOP = %STOP% >&2
echo. STEP = %STEP% >&2
echo.
set "err_msg=Invalid number of processes"
if %START% lss 2 goto error
if %START% gtr %STOP% goto error
for /l %%i in ( %START%, %STEP%, %STOP% ) do (
echo.= %%i Ranks ============================= >&2
mpiexec.exe -np %%i "%EXE%" "%DATA%" -%NBENCH% nul: >"%%i.log" 2>&1
if errorlevel 1 (
set "err_msg=(%errorlevel%)"
goto error
)
echo....Ok >&2
)
set "err_msg="
:error
if not "%err_msg%"=="" echo *** ERROR: %err_msg% >&2 & pause
endlocal & endlocal