[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Thu May 19 23:15:01 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/5f8431e04f44
branches:  release-2-4-x
changeset: 5210:5f8431e04f44
user:      Andy Buckley <andy at insectnation.org>
date:      Fri May 13 21:12:57 2016 +0100
description:
rivet-buildplugin: add --dry-run as an option alias to --cmd

details:   https://rivet.hepforge.org/hg/rivet/rev/2a41c2c1ea58
branches:  release-2-4-x
changeset: 5211:2a41c2c1ea58
user:      Andy Buckley <andy at insectnation.org>
date:      Thu May 19 23:13:40 2016 +0100
description:
Get make-plots CPU count from multiprocessing -- makes sense, since that's how we use it

diffs (truncated from 57 to 50 lines):

--- a/bin/make-plots	Thu May 12 14:46:34 2016 +0100
+++ b/bin/make-plots	Thu May 19 23:13:40 2016 +0100
@@ -2464,8 +2464,10 @@
         pass
 
     ## Find number of (virtual) processing units
-    numcores = os.sysconf('SC_NPROCESSORS_ONLN')
-    if numcores is None:
+    import multiprocessing
+    try:
+        numcores = multiprocessing.cpu_count()
+    except:
         numcores = 1
 
     ## Parse command line options
@@ -2611,7 +2613,6 @@
     datfiles = args
     plotword = "plots" if len(datfiles) > 1 else "plot"
     logging.info("Making %d %s" % (len(datfiles), plotword))
-    import multiprocessing
     pool = multiprocessing.Pool(opts.NUM_THREADS, init_worker)
     try:
         for i, _ in enumerate(pool.imap(process_datfile, datfiles)):
--- a/bin/rivet-buildplugin.in	Thu May 12 14:46:34 2016 +0100
+++ b/bin/rivet-buildplugin.in	Thu May 19 23:13:40 2016 +0100
@@ -21,7 +21,7 @@
     echo "Options:"
     echo "  -h | --help: display this help message"
     echo "  --with-root: add ROOT link options (requires root-config on system)"
-    echo "  --cmd: just print the generated compiler command, do not execute it
+    echo "  --cmd|--dry-run: just print the generated compiler command, do not execute"
     echo
     echo "TODO:"
     echo "  * is there a GCC option to parallelise the single-command compilation?"
@@ -108,9 +108,9 @@
 
 
 ## Just show the compiler command rather than execute it, if requested
-only_show=$(echo $* | egrep -- '--\<cmd\>') #-\<n\>')
+only_show=$(echo $* | egrep -- '--\<cmd\>|--\<dry-run\>')
 # echo $only_show
-tmp=${@//--cmd/}
+tmp=$(echo $@ | sed -e 's/--cmd//g' -e 's/--dry-run//g')
 set $tmp #< Set positional params
 
 
--- a/bin/rivet-completion	Thu May 12 14:46:34 2016 +0100
+++ b/bin/rivet-completion	Thu May 19 23:13:40 2016 +0100
@@ -109,7 +109,7 @@
     cur="${COMP_WORDS[COMP_CWORD]}"


More information about the Rivet-svn mailing list