#!/bin/csh -f
##### 
##   Sung-Hoon Ko
##   4/11/98
#####


# Run synthetic test cases
 
set sources = (Life.java Hello.java)
          
 
set nprocs  = (4 2)

set mpiJavaHome = @top_srcdir@

set MPI       = @MPI@

set MPI_PATH  = @MPIPATH@
set JAVA_PATH = @JAVA@

set MPI_RUN  = "${MPI_PATH}/bin/mpirun -np"
set CLASS_PATH = "-classpath .:${mpiJavaHome}/lib/classes:${JAVA_PATH}/lib/classes.zip:${JAVA_PATH}/classes"
set JAVA_C = "${JAVA_PATH}/bin/javac ${CLASS_PATH}"
set JAVA_RUN = "${JAVA_PATH}/bin/java ${CLASS_PATH}"


if ($MPI == mpich) then
  set machineFile = machines
else if ($MPI == sp2) then
  set machineFile = host.list
else if ($MPI == sunhpc) then
  set machineFile = 
else
  echo Not supported yet. ; exit 1
endif

 
#(hostname; hostname; hostname; hostname; hostname ; hostname ; hostname ; hostname ) > $machineFile


set CWD = `pwd`
#echo ----------- Test mpiJava compiling  ------------
foreach source ($sources)
	echo ...Compiling : {$CWD:t}/${source}
	${JAVA_C} $source 


#echo ----------- Test mpiJava running  ------------
	set executable=${source:r}
	if ( -f ./$executable.jig ) then
	    rm -f ./$executable.jig
	endif
	#echo .....Running : {$CWD:t}/${source}
	echo .....Running : $mpiJavaHome/script/prunjava ${nprocs[1]} $executable 
	$mpiJavaHome/src/scripts/prunjava ${nprocs[1]} $executable
	shift nprocs
end



