#! /bin/csh -f
# Last edited on 2011-06-06 21:28:09 by stolfi

set ver = "sun"
set out = "out/${ver}.`/bin/uname -n`.14CP"
echo "writing to ${out}"

echo "compiling program..."
cc -c -v -B static -Xt -fast -xO4 -xarch=v9 -dalign test-threads.c
cc -o tt.${ver} test-threads.o -xarch=v9 -lm -lpthread

echo "running..."

echo "thread test for Sun" > ${out}

/bin/uname -a >> ${out}
/usr/sbin/psrinfo -v >> ${out}
/bin/date >> ${out}

set mb = 6000

set mops = 300

set npr = 48


echo "trying up to ${npr} threads"

foreach nth ( 1 2 4 8 10 16 20 24 32 48 )
  if ( $nth <= ${npr} ) then
    tt.${ver}   6700 ${mb} ${mops} 0 ${nth} >>& ${out}
    tt.${ver} 160000 ${mb} ${mops} 0 ${nth} >>& ${out}
    tt.${ver}   6700 ${mb} ${mops} 1 ${nth} >>& ${out}
  endif
  echo "thread now running... ${nth} begin"
end

foreach nth ( 1 2 4 8 10 16 20 24 32 48 )
  if ( $nth <= ${npr} ) then
    tt.${ver} 160000 ${mb} ${mops} 1 ${nth} >>& ${out}
  endif
  echo "thread2 now running... ${nth} begin"
end

/bin/date >> ${out}

echo "done."
 
