mirror of
https://github.com/nwchemgit/nwchem.git
synced 2026-07-21 06:25:21 -04:00
DEC OS/F is an obsolete Unix operating system (https://en.wikipedia.org/wiki/Tru64_UNIX).
114 lines
3.7 KiB
Tcsh
Executable file
114 lines
3.7 KiB
Tcsh
Executable file
#!/bin/csh -f
|
|
#
|
|
# $Id$
|
|
# this script tries to figure out no. of processors and RAM
|
|
# to get the maximum available memory in memor_def.F
|
|
# It can also pick up an alternate amount of memory to take
|
|
# out for the OS, if available. This amount is per processor
|
|
# and is in units of megabytes
|
|
#
|
|
set memos = $1
|
|
if (null$memos == null) set memos = 30
|
|
#
|
|
cd $NWCHEM_TOP/src/input
|
|
set a=("" "" "" "" "" "")
|
|
set good=1
|
|
|
|
if ($NWCHEM_TARGET == LINUX) then
|
|
set nproc = `egrep processor /proc/cpuinfo | wc --line`
|
|
set memtot = `egrep -i MemT /proc/meminfo | sed -e "s/kB//g"|sed -e "s/MemTotal://" `
|
|
else if ($NWCHEM_TARGET == LINUX64) then
|
|
if(`uname -m` == ia64) then
|
|
set nproc = `egrep processor /proc/cpuinfo | wc -l`
|
|
else if(`uname -m` == x86_64) then
|
|
set nproc = `egrep processor /proc/cpuinfo | wc -l`
|
|
else
|
|
#this works for Alpha
|
|
set nproc = `egrep cpus /proc/cpuinfo | sed -e "s/cpus detected : //"`
|
|
endif
|
|
set memtot = `egrep -i MemT /proc/meminfo | sed -e "s/kB//g"|sed -e "s/MemTotal://" `
|
|
else if ($NWCHEM_TARGET == MACX64) then
|
|
set nproc = `sysctl -n hw.ncpu`
|
|
set memtot = `sysctl -n hw.memsize`
|
|
@ memtot = ($memtot / 1024)
|
|
else if ($NWCHEM_TARGET == SGI_N32 || $NWCHEM_TARGET == SGITFP ) then
|
|
set a=`/sbin/hinv -c processor|head -1`
|
|
set nproc=$a[1]
|
|
set a=`/sbin/hinv -c memory | head -1`
|
|
@ memtot = ($a[4] * 1024)
|
|
else if ($NWCHEM_TARGET == SOLARIS ) then
|
|
set nproc = `/usr/sbin/psrinfo | wc -l `
|
|
set a=`/usr/sbin/prtconf | egrep -i mem `
|
|
@ memtot = ($a[3] * 1024)
|
|
else if ($NWCHEM_TARGET == IBM || $NWCHEM_TARGET == IBM64 || $NWCHEM_TARGET == LAPI || $NWCHEM_TARGET == LAPI64) then
|
|
set nproc=`/usr/sbin/lsdev -Cc processor | wc -l `
|
|
set nmcard = `/usr/sbin/lsdev -Cc memory | egrep mem | wc -l`
|
|
set i=0
|
|
set memtot=0
|
|
while ($i != $nmcard)
|
|
set a=`/usr/sbin/lsattr -E -l mem$i |head -1`
|
|
set cardmem=$a[2]
|
|
@ memtot = ($memtot + $cardmem)
|
|
@ i = ($i + 1)
|
|
end
|
|
@ memtot = ($memtot * 1024)
|
|
else if ($NWCHEM_TARGET == HPUX || $NWCHEM_TARGET == HPUX64 ) then
|
|
set nproc=`/usr/sbin/ioscan -fkC processor | grep '^proc' | wc -l `
|
|
cat > getmemhp.c <<EOF
|
|
#include <sys/param.h>
|
|
#include <sys/pstat.h>
|
|
#include <sys/unistd.h>
|
|
main()
|
|
{
|
|
struct pst_static buf;
|
|
pstat_getstatic(&buf, sizeof(buf), 0, 0);
|
|
printf(" %ld\n", buf.physical_memory);
|
|
}
|
|
EOF
|
|
cc -Wl,+vnocompatwarnings -o getmemhp getmemhp.c
|
|
set memtot=`./getmemhp`
|
|
rm -f ./getmemhp
|
|
else
|
|
set good=0
|
|
endif
|
|
|
|
if($good != 0) then
|
|
set memproc=0
|
|
@ memproc = ($memtot / $nproc)
|
|
@ memprocgb = ($memproc / 1000000)
|
|
echo "Total Memory :" $memtot "Kb"
|
|
echo "No. of processors :" $nproc
|
|
echo "Total Memory/proc :" $memproc "KB = " $memprocgb "GB"
|
|
# take away memory for OS
|
|
@ memproc = (($memproc - ($memos * 1024)))
|
|
# multiply by 128=(1024/8) to get to doubles
|
|
@ memproc = ($memproc * 128)
|
|
if($good == 1) then
|
|
set copt=" -DDFLT_TOT_MEM="$memproc
|
|
touch memory_def.F
|
|
set mymake=`which make`
|
|
echo `/usr/bin/strings $mymake | egrep GNU | head -1` >! tmp.out.test
|
|
set nbyte=`wc -c tmp.out.test`
|
|
rm -f tmp.out.test
|
|
if ($nbyte[1] != 0) then
|
|
echo "Executing " 'make LIB_DEFINES+="'$copt'"'
|
|
# this is need for PGI
|
|
#make FC=pgf77 LIB_DEFINES+="$copt "
|
|
make LIB_DEFINES+="$copt "
|
|
cd $NWCHEM_TOP/src
|
|
make link
|
|
else
|
|
echo "Executing " 'gmake LIB_DEFINES+="'$copt'"'
|
|
gmake LIB_DEFINES+="$copt "
|
|
cd $NWCHEM_TOP/src
|
|
gmake link
|
|
endif
|
|
else
|
|
echo " "
|
|
echo "Edit memory_def.F and change DFLT_TOT_MEM to "$memproc
|
|
echo " "
|
|
endif
|
|
else
|
|
echo "not ready for " $NWCHEM_TARGET
|
|
endif
|
|
|