[Swift-commit] r8111 - SwiftTutorials/ATPESC_2014-08-14/mainwrap/app

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Tue Aug 12 12:38:43 CDT 2014


Author: ketan
Date: 2014-08-12 12:38:43 -0500 (Tue, 12 Aug 2014)
New Revision: 8111

Added:
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/build-docs.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean-data.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/create-data.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/install-docs.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/link-static-tcl.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.c
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.h
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.manifest
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/preproc.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/prerun.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run-cobalt.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run.sh
   SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/settings.bgq.sh
Log:
mockdock

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/build-docs.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/build-docs.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/build-docs.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Build asciidoc html from README.txt
+
+asciidoc -a toc -a toclevels=2  -a max-width=750px  -a textwidth=80 -o README.html README.txt


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/build-docs.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean-data.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean-data.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean-data.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,5 @@
+#!/bin/bash -eu
+
+# Removes data created by create-data.sh
+
+rm -rfv peptides prots prot.txt


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean-data.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,9 @@
+#!/bin/bash -eu
+
+rm -fv *.o *.so *.a mockdock
+rm -fv *_wrap*
+rm -fv static_leaf_main{,.c} extension.c
+rm -fv make-package.tcl pkgIndex.tcl
+rm -fv user-code.{swift,tcl}
+rm -fv user-leaf.{c,h,tcl}
+rm -fv run-*.out


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/clean.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/create-data.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/create-data.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/create-data.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,49 @@
+#!/bin/bash -eu
+
+# Creates input data for mockdock
+
+usage() {
+  echo "gendata: usage:"
+  echo
+  printf "\t\t gendata <NUMPEPT> <NUMENT>"
+  echo
+  printf "\t where: \n"
+  printf "\t\t NUMPEPT     is the number of peptides in each entry\n"
+  printf "\t\t NUMENT      is the number of entries\n"
+}
+
+if [[ ${#*} != 2 ]] 
+then
+  usage 
+  exit 1
+fi
+
+numpept=$1
+nument=$2
+
+# Clean up
+rm -rf peptides
+
+mkdir -p peptides 
+pushd peptides 2>&1 > /dev/null
+
+for j in $(seq 1 $nument) ; do
+  echo $RANDOM
+done > master.txt
+
+for i in $(seq 1 $numpept) ; do
+  #symlink to master
+  ln -s master.txt pept${i}.txt
+done
+
+popd 2>&1 > /dev/null
+
+echo $RANDOM > prot.txt
+
+#Create dummy prot files for nested loop
+mkdir -p prots
+pushd prots 2>&1 > /dev/null
+for k in $(seq 1 20) ; do
+    echo $RANDOM > prot${k}.txt
+done
+popd 2>&1 > /dev/null


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/create-data.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/install-docs.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/install-docs.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/install-docs.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Install asciidoc html in CI WWW
+
+scp README.html login.ci.uchicago.edu:/ci/www/projects/swift/guides/T/main-wrap.html


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/install-docs.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/link-static-tcl.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/link-static-tcl.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/link-static-tcl.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,10 @@
+#!/bin/bash -eu
+
+bgxlc_r -c -I . \
+  -I /home/wozniak/Public/sfw/ppc64/bgxlc/static_r/tcl-8.5.12/include \
+  static_leaf_main_tcl.c
+
+
+bgxlc_r -o static_leaf_main_tcl static_leaf_main_tcl.o leaf_main.a  \
+   -L /home/wozniak/Public/sfw/ppc64/bgxlc/static_r/tcl-8.5.12/lib \
+   -ltcl8.5

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.c
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.c	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.c	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,65 @@
+
+/**
+   The mockdock application code
+   May be run as
+   1) stand-alone executable via Makefile
+   2) as Swift library via genleaf
+*/
+
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "mockdock.h"
+
+static void usage(void){
+  printf("usage: mockdock <protfile> <peptfile> <delay>\n");
+}
+
+int main(int argc, char** argv){
+
+    if (argc != 4){
+      usage();
+      exit(EXIT_FAILURE);
+    }
+    char* protfile = argv[1];
+    char* peptfile = argv[2];
+    int   runtime  = atoi(argv[3]);
+
+    int fd1 = open(protfile, O_RDONLY);
+    if (fd1 < 0){
+      printf("could not open: %s\n", protfile);
+      exit(1);
+    }
+
+    int fd2 = open(peptfile, O_RDONLY);
+    if (fd2 < 0){
+      printf("could not open: %s\n", peptfile);
+      exit(1);
+    }
+    sleep(runtime);
+    printf("result number: %d\n", dock(fd1, fd2));
+
+    close(fd1);
+    close(fd2);
+
+    return 0;
+}
+
+size_t maxsize=10*1024*1024;
+
+int dock(int fd1, int fd2){
+
+  char* buf = malloc(maxsize);
+
+  int len1 = read(fd1, buf, maxsize);
+  assert(len1 >= 0); 
+
+  int len2 = read(fd2, buf, maxsize);
+  assert(len2 >= 0); 
+
+  return(len1 * 1000000 + len2);
+}

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.h
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.h	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.h	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,2 @@
+int dock(int fd1, int fd2);
+int leaf_main(int argc, char** argv);

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.manifest
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.manifest	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/mockdock.manifest	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,38 @@
+
+# MOCKDOCK.MANIFEST
+# Manifest file to build Turbine application executable
+# Copied from Turbine's example.manifest
+
+# Name and version of Tcl package
+pkg_name = leaf_main
+pkg_version = 0.0
+
+# C function names to initialise Tcl modules
+lib_init = Mockdock_wrap_Init
+
+# lib scripts are executed in specified order, before main_script and
+# after lib_inits
+lib_script = mockdock_wrap.tcl
+
+# Headers for user Tcl code, e.g. lib_init functions
+lib_include = mockdock.h
+lib_include = extension.h
+
+# STC-generated Turbine Tcl script.
+main_script = user-code.tcl
+
+# Build info follows: required to compile and link executable
+
+# lib objects are linked into executable
+lib_object = leaf_main.a
+# lib_object = /home/wozniak/Public/sfw/ppc64/tcl-8.5.12/lib/libtclstub8.5.a
+# lib_object = /home/wozniak/Public/sfw/ppc64/c-utils/lib/libexmcutils.a
+# lib_object = /home/wozniak/Public/sfw/ppc64/lb/lib/libadlb.a
+
+# lib shared object (linked against - not preferred).
+# This goes last on link command
+linker_libs =
+
+# Local Variables:
+# mode:tcl
+# End:

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/preproc.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/preproc.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/preproc.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,4 @@
+# @dispatch=WORKER
+# (int v) leaf_main(string arg[], string env[]) "leaf_main" "0.0" "leaf_main";
+
+sed -e '/mainapp/i at dispatch=WORKER' -e '/mainapp/s/^.*mainapp \(.*\);/(int v) \1_main(string arg[]) "\1_main" "0.0" "\1_main_wrap";/'


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/preproc.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/prerun.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/prerun.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/prerun.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+ln -s $PWD/peptides  $TURBINE_OUTPUT
+ln -s $PWD/prots  $TURBINE_OUTPUT
+ln -s $PWD/prot.txt $TURBINE_OUTPUT


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/prerun.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run-cobalt.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run-cobalt.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run-cobalt.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,80 @@
+#!/bin/bash -eu
+
+show_machine_files()
+{
+  ( cd $GENLEAF_HOME/settings
+    ls machine.*.sh | sed 's/machine\.\(.*\).sh/ \t * \1/' )
+}
+
+usage()
+{
+  echo "run-cobalt.sh: usage:"
+  echo
+  printf "\t\t run-cobalt.sh <MACHINE> <PROCS>\n"
+  echo
+  printf "\t where: \n"
+  printf "\t\t MACHINE     is the machine type\n"
+  printf "\t\t PROCS       is the number of MPI processes\n"
+  echo
+  echo "known machine types:"
+  show_machine_files
+}
+
+crash()
+{
+  MSG=$*
+  echo "crash!"
+  echo $MSG
+  exit 1
+}
+
+TURBINE_RUN=$( which turbine-cobalt-run.zsh ; true ) 
+if [[ $TURBINE_RUN == "" ]]
+then
+  echo "Could not find turbine-cobalt-run.zsh in PATH!"
+  exit 1
+fi
+
+TURBINE_HOME=$( cd $( dirname $TURBINE_RUN )/../../.. ; /bin/pwd )
+GENLEAF_HOME=$TURBINE_HOME/scripts/main-wrap
+
+echo "TURBINE_HOME=$TURBINE_HOME"
+
+if [[ ${#*} != 2 ]]
+then
+  usage
+  exit 1
+fi
+
+MACHINE=$1
+numprocs=$2
+
+# Assert that numprocs is a number: 
+if ! (( $numprocs + 1 )) ; then 
+  echo "PROCS must be a number: received: $numprocs"
+  exit 1
+fi 
+
+USER_SWIFT=user-code.swift
+
+MACHINE_FILE=$TURBINE_HOME/scripts/main-wrap/settings/machine.$MACHINE.sh
+[[ -f $MACHINE_FILE ]] || crash "unknown machine type: $MACHINE"
+source $MACHINE_FILE
+
+USER_TCL=user-code.tcl
+[[ -f $USER_TCL ]] || crash "could not find compiled Swift runtime code: $USER_TCL"
+
+rm -rf work
+mkdir work
+
+export TURBINE_OUTPUT=$PWD/work
+
+ln -s $PWD/peptides $TURBINE_OUTPUT
+ln -s $PWD/prot.txt $TURBINE_OUTPUT
+
+ENV="--env ADLB_DEBUG=0:ADLB_TRACE=0"
+
+# $TURBINE_RUN -n $numprocs -s settings.bgq.sh $USER_TCL 
+export PROJECT=ExM
+set -x 
+qsub -n $numprocs -t 5 $ENV $PWD/static_leaf_main


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run-cobalt.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,11 @@
+#!/bin/bash -eu
+
+# Run the user program locally using normal Turbine
+# Creates run-*.out containing a copy of the output
+
+export TURBINE_USER_LIB=$PWD
+
+TIME=$( date +%H:%M:%S )
+OUTPUT=run-$TIME.out
+
+turbine -l -n 4 user-code.tcl |& tee $OUTPUT


Property changes on: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/run.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/settings.bgq.sh
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/settings.bgq.sh	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/mainwrap/app/settings.bgq.sh	2014-08-12 17:38:43 UTC (rev 8111)
@@ -0,0 +1,10 @@
+export MODE=BGQ
+export WALLTIME=00:15:00
+export PROJECT=ExM
+export PPN=64
+export QUEUE=default
+export ADLB_PRINT_TIME=1
+export TURBINE_LOG=0
+export TURBINE_DEBUG=0
+export TURBINE_ENGINES=128
+export ADLB_SERVERS=128




More information about the Swift-commit mailing list