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


# Run synthetic test cases
 
#set sources = (abort.java initialized.java procname.java wtime.java)
set sources = (initialized.java procname.java wtime.java)
          
 
set nprocs  = 2

set mpiJavaHome = @top_srcdir@
set mpiJavaClasses = @top_srcdir@/lib/classes

set MPI       = @MPI@

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

set MPI_RUN  = "${MPI_PATH}/bin/mpirun -np"
set CLASS_PATH = "-classpath .:${mpiJavaClasses}:${JAVA_PATH}/lib/classes.zip:${JAVA_PATH}/classes:/project/pss_shko/mpiJava/V0.9/tests/simple"
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
end
