#!/bin/csh
#  Lab #5 example script to vary N

echo varying N
set N = 250
while ( $N < 263 )
  cc -DN=$N -DOFFSET=0 -DFILLER=0 -no_inline -O3 matmul.c -o matmul
  matmul 
  @ N = $N + 1
end

echo do instrumented run for N=256
echo compiling...
cc -DN=256 -DOFFSET=0 -DFILLER=0  -Wl,-r -non_shared -no_inline -O3 matmul.c -o matmul.rr

# compile the atomized version as matmul.atomd
echo atomizing...
atom matmul.rr instr2.c analy2.c -o matmul.atomd

# compile the non-instrumented version for doing a timing run on
echo making executable...
ld matmul.rr -o matmul

# do a timed run 
echo timed run...
matmul

# do a dinero run for one-level cache
matmul.atomd | dinero -i8K -d8K -b32 -ww -An -a1 -B8 -W8 -z100000000000 

