#!/bin/csh

#
# pr2ppvp
#
# (C) 1995 by bird@cs.uni-sb.de (Jochen Rhrig)
#
#
# takes a number procnum of processes as its first and only argument
#
# outputs the number of physical and virtual processors needed on the
#         SBPRAM-simulator to run procnum processes
#
# if procnum <= 32 the number of virtual processors is set to procnum and
#                  the number of physical processors is set to 1
# if procnum > 32 procnum is rounded to the next multiple of 32,
#                 the number of virtual processors is set to 32 and
#                 the number of physical processors is set to procnum div 32
#

if ( $#argv != 1 ) goto usage

set ppnum=`expr $1 \/ 32`
set pmod=`expr $1 - $ppnum \* 32`

if ( $ppnum == 0 ) then
set vpnum=$pmod
else
set vpnum=32
endif

if ( $pmod != 0 ) set ppnum=`expr $ppnum + 1`

echo $ppnum $vpnum

exit 0


usage:

echo " "
echo "	usage: $0 procnum"
echo " "
echo "	converts procnum into the appropriate number of physical"
echo "	and virtual processors on the SBPRAM-simulator"
echo " "

exit 1
