Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

Executing a BAT sript with white space in its path + passing arguments with white spaces

Diego_R_
Beginner
10,397 Views

Dear All, 

We recently switched from mpich2 to intel mpi. I have problems starting a bat script when the path to the script and the argument passed to the script both contain whitespaces: 

"path-To-MPI\mpiexec" -delegate -n 1 "path with spaces"\test.bat "argument with space"

Is there a solution to this problem ? 

Thanks

Diego

Example 1) : 

J:\Users\diego>"C:\Users\diego\AppData\Local\XXX Software\MPI\impi5\mpiexec.exe" -delegate -n 1 "J:\Users\diego\abc DRuiz\test2.bat" "tu tu"

'J:\Users\diego\abc' is not recognized as an internal or external command, operable program or batch file.

2) If my argument does not contain white spaces, then it works 

J:\Users\diego>"C:\Users\diego\AppData\Local\XXX Software\MPI\impi5\mpiexec.exe" -delegate -n 1 "J:\Users\diego\abc DRuiz\test2.bat" "tu-tu"

J:\Users\diego>echo LOCAL "test2.BAT" STARTED
LOCAL "test2.BAT" STARTED

3) If I use an executable instead of a BAT script, it also works: 

J:\Users\diego>"abc DRuiz\qt2.bat

J:\Users\diego>"C:\Users\diego\AppData\Local\XXX Software\MPI\impi5\mpiexec.exe" -delegate -n 1 "J:\Users\diego\abc DRuiz\bin\abcd.exe" "tu tu"

  <***>   Software - rev 98765
Info    : Welcome diego

...                     

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

 

 

 

0 Kudos
7 Replies
James_S
Employee
10,397 Views

Hi Diego,

You have also submitted the issue via Intel Online Service Center, I have reproduced the issue and escalated it to the developers. Thanks.

Best regards,

Zhuowei

 

0 Kudos
Diego_R_
Beginner
10,397 Views

It does not seem to work with mpiexec; Could you provide a sintax working with mpiexec ? 

1) J:\Users\diego\abc DRuiz>impi5\mpiexec.exe -delegate -n 1 "J:\Users\diego\abc DRuiz\test2.bat "tu tu""

[-1:11284]ERROR:execvp error on file: J:\Users\diego\abc DRuiz\test2.bat tu, The filename, directory name, or volume label syntax is incorrect.

2) J:\Users\diego\abc DRuiz>impi5\mpiexec.exe -delegate -n 1 "J:\Users\diego\abc DRuiz\test2.bat \"tu tu\""
[-1:13644]ERROR:execvp error on file: J:\Users\diego\abc DRuiz\test2.bat "tu tu", The filename, directory name, or volume label syntax is incorrect.

3) J:\Users\diego\abc DRuiz>impi5\mpiexec.exe -delegate -n 1 ""J:\Users\diego\abc DRuiz\test2.bat" "tu tu""
[-1:9604]ERROR:execvp error on file: J:\Users\diego\abc, The filename, directory name, or volume label syntax is incorrect.

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
10,397 Views
Intel(R) MPI Library 2017 for Windows* Target Build Environment for Intel(R) 64
applications
Copyright (C) 2007-2016 Intel Corporation. All rights reserved.


C:\Windows\system32>cd \

C:\>md "test\diego"

C:\>md "test\diego\abc DRuiz"

C:\>echo arg1=%1, arg2=%2>"test\diego\abc DRuiz\test2.bat"

C:\>type "test\diego\abc DRuiz\test2.bat"
arg1=%1, arg2=%2

C:\>notepad "test\diego\abc DRuiz\test2.bat"

C:\>mpiexec -n 1 "C:\test\diego\abc DRuiz\test2.bat" X Y

C:\>echo arg1=X, arg2=Y
arg1=X, arg2=Y

C:\>

Note, the notepad was to edit the test2.bat file to insert the missing "echo "

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
10,397 Views

Edit, added:

C:\>mpiexec -n 1 "C:\test\diego\abc DRuiz\test2.bat" "X Y" "a b"
'C:\test\diego\abc' is not recognized as an internal or external command,
operable program or batch file.

So the problem is not on the program, but rather on the arguments. Let me experiment more...

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
10,397 Views

Awful hack:

C:\>type "test\diego\abc DRuiz\test2.bat"
echo arg1=%arg1%, arg2=%arg2%

C:\>set arg1=X Y

C:\>set arg2=a b

C:\>mpiexec -n 1 "C:\test\diego\abc DRuiz\test2.bat"

C:\>echo arg1=X Y, arg2=a b
arg1=X Y, arg2=a b

Using environment variables to pass args, ugly as it is, may get you by for now.

Jim Dempsey

0 Kudos
Diego_R_
Beginner
10,397 Views

I do not like the solution with environment variables for two reasons: 

1) I will need to pass the environment variable to remote processes (kind of ok with -genvall or similar)

2) Each call to  mpiexec made by my application needs to set a different value to the environment variable. Therefore I can not make concurrent calls anymore* !!  (For example, we start 10 different mesh generations simultanesouly, each one relying on a mpi session ).

* Using different environment variable names is not a solution: If I have to write the script to change the variable name each time, then I also need to transmit the script to remote computers ...  Furthermore, if the script needs to be slightly different on each machine, then I have to prefetch it ... and I need to clean used environment variable names ... plus risk of environment variable name collision.

 

0 Kudos
Reply