Salome HOME
Revert "Synchronize adm files"
[modules/kernel.git] / src / MPIContainer / launch_testMPI2.csh
1 #! /bin/csh -f
2
3 # Copyright (C) 2011-2014  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21
22 # debug mode display informations about communication
23 if $1 == "--debug" then
24   set debug="-debug"
25 else
26   set debug=""
27 endif
28 # get pid of ompi-server
29 setenv OMPI_URI_FILE ${HOME}/.urifile_$$
30 set lpid1=`pidof ompi-server`
31 ompi-server -r ${OMPI_URI_FILE}
32 set lpid2=`pidof ompi-server`
33 foreach i ($lpid2)
34   set flag=0
35   foreach j ($lpid1)
36     if ($i == $j) then
37       set flag=1
38     endif
39   end
40   if ($flag == 0) then
41     set pid=$i
42   endif
43 end
44 sleep 2
45 # launch two instances of executable to create communication between both
46 mpirun -np 2 -ompi-server file:${OMPI_URI_FILE} ${KERNEL_ROOT_DIR}/bin/salome/testMPI2 -vsize 32 $debug &
47 mpirun -np 3 -ompi-server file:${OMPI_URI_FILE} ${KERNEL_ROOT_DIR}/bin/salome/testMPI2 -vsize 32 $debug
48 set res=$status
49 sleep 1
50 # kill ompi-server
51 kill -9 $pid
52 # delete uri file
53 rm -f  ${OMPI_URI_FILE}
54 # give result of test
55 if $res == 0 then
56   echo "OK"
57 else
58   echo "KO"
59 endif
60 exit $res