
macro setup
  module pantasks.pro

  module chip.pro
  module camera.pro
  module fake.pro
  module warp.pro
  module stack.pro
  module diff.pro
  module magic.pro
  module destreak.pro
  module dist.pro
  module rcserver.pro

  module survey.pro

  module site.mhpcc.pro
  init.copy.mhpcc on
  queueload tmp -x "cat $MODULES:0/ipphosts.mhpcc.config"
  ipptool2book tmp ipphosts -key camera

  # XXX merge the above into init.site more cleanly (careful with summit copy stuff)
  # init.site (we do not use init.site because it loads the hosts)

  # magic.ds.off

  add.database gpc1
  add.label dummy
  set.poll 180
end

macro load.hosts.wave1
  controller host add ipp005 -threads 4 
  controller host add ipp006 -threads 4
  controller host add ipp007 -threads 4 
# controller host add ipp008 -threads 4 (flaky)
# controller host add ipp009 -threads 4 (problem with cpu 3)
  controller host add ipp010 -threads 4
  controller host add ipp011 -threads 4
  controller host add ipp012 -threads 4
  controller host add ipp013 -threads 4
  controller host add ipp014 -threads 4
# controller host add ipp016 -threads 4 (flaky)
  controller host add ipp017 -threads 4
# controller host add ipp018 -threads 4 (flaky)
  controller host add ipp019 -threads 4 
  controller host add ipp020 -threads 4
  controller host add ipp021 -threads 4
end

macro load.hosts.wave2
  controller host add ipp015 -threads 4
  controller host add ipp017 -threads 4
  controller host add ipp023 -threads 4
  controller host add ipp024 -threads 4
  controller host add ipp026 -threads 4
  controller host add ipp027 -threads 4
  controller host add ipp028 -threads 4
  controller host add ipp029 -threads 4
  controller host add ipp030 -threads 4
  controller host add ipp031 -threads 4
  controller host add ipp032 -threads 4
  controller host add ipp033 -threads 4
  controller host add ipp034 -threads 4
  controller host add ipp035 -threads 4
  controller host add ipp036 -threads 4
end

macro load.hosts.wave3
  controller host add ipp038 -threads 4
  controller host add ipp039 -threads 4
  controller host add ipp040 -threads 4
  controller host add ipp041 -threads 4
  controller host add ipp042 -threads 4
  controller host add ipp043 -threads 4
  controller host add ipp044 -threads 4
  controller host add ipp045 -threads 4
  controller host add ipp046 -threads 4
  controller host add ipp047 -threads 4
  controller host add ipp048 -threads 4
  controller host add ipp049 -threads 4
  controller host add ipp050 -threads 4
  controller host add ipp051 -threads 4
  controller host add ipp052 -threads 4
  controller host add ipp053 -threads 4
end

macro load.hosts.compute
  controller host add ippc00 -threads 4
  controller host add ippc01 -threads 4
  controller host add ippc02 -threads 4
  controller host add ippc03 -threads 4
  controller host add ippc04 -threads 4
  controller host add ippc05 -threads 4
  controller host add ippc06 -threads 4
  controller host add ippc07 -threads 4 
  controller host add ippc08 -threads 4
  controller host add ippc09 -threads 4
# controller host add ippc10 -threads 4 (pantasks - stdscience)
  controller host add ippc11 -threads 4
  controller host add ippc12 -threads 4
  controller host add ippc13 -threads 4
  controller host add ippc14 -threads 4
  controller host add ippc15 -threads 4
  controller host add ippc16 -threads 4
  controller host add ippc17 -threads 4
#  controller host add ippc18 -threads 4 (ipp home)
#  controller host add ippc19 -threads 4 (ipp home)
end

macro show.book
  if ($0 != 2)
   echo "USAGE: show.book (book)"
   break
  end

  book npages $1 -var npages
  for i 0 $npages
    book getpage $1 $i -var pagename
    book listpage $1 $pagename
  end

  echo "npages: $npages"
end

macro del.page.from.book
  if ($0 != 3)
   echo "USAGE: show.book (book) (page)"
   break
  end

  book delpage $1 $2
end

macro chip.revert.on
  task chip.revert
    active true
  end
end

macro chip.revert.off
  task chip.revert
    active false
  end
end

macro camera.revert.on
  task camera.revert
    active true
  end
end

macro camera.revert.off
  task camera.revert
    active false
  end
end

macro warp.revert.on
  task warp.revert.warped
    active true
  end
  task warp.revert.overlap
    active true
  end
end

macro warp.revert.off
  task warp.revert.warped
    active false
  end
  task warp.revert.overlap
    active false
  end
end

macro adjust.magic
  task magic.tree.run
    periods -poll 0.5
    periods -exec 1.0
  end
  task magic.process.run
    periods -poll 0.5
    periods -exec 1.0
  end
  task magic.tree.load
    periods -poll 1.0
    periods -exec 5.0
  end
  task magic.process.load
    periods -poll 1.0
    periods -exec 5.0
  end
end
