Browse Source

Using a smaller dataset of primes, if not in cluster mode.

Refine the script primes.sh to accept a parameter $1, the number of millions of
primes that wants to be used as pool.
Now, by default a simple user downloads only the first million of primes.
A cluster user instead will download 20M primes.
Please note that the maximum is 22 as of today.
Michele Orrù 10 years ago
parent
commit
a515a5d047
3 changed files with 13 additions and 4 deletions
  1. 7 1
      Makefile.am
  2. 5 2
      Makefile.in
  3. 1 1
      src/apps/primes.sh

+ 7 - 1
Makefile.am

@@ -4,6 +4,12 @@ AUTOMAKE_ARGS = --add-missing
 
 dist_doc_DATA = README
 
+if CLUSTER
+all-local:
+	test -f primes.txt || ./src/apps/primes.sh 20
 
+else
 all-local:
-	test -f primes.txt || ./src/apps/primes.sh
+	test -f primes.txt || ./src/apps/primes.sh 1
+
+endif

+ 5 - 2
Makefile.in

@@ -806,8 +806,11 @@ uninstall-am: uninstall-dist_docDATA
 	tags-am uninstall uninstall-am uninstall-dist_docDATA
 
 
-all-local:
-	test -f primes.txt || ./src/apps/primes.sh
+@CLUSTER_TRUE@all-local:
+@CLUSTER_TRUE@	test -f primes.txt || ./src/apps/primes.sh 20
+
+@CLUSTER_FALSE@all-local:
+@CLUSTER_FALSE@	test -f primes.txt || ./src/apps/primes.sh 1
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 1 - 1
src/apps/primes.sh

@@ -2,7 +2,7 @@
 
 > primes.txt
 
-for i in {1..16}
+for i in `seq $1`
 do
     curl "http://primes.utm.edu/lists/small/millions/primes$i.zip" | funzip - | \
         tail -n +3 | sed -E 's/[[:space:]]+/\n/g' -| sed -e '/^$/d'  >> primes.txt