This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://tour.golang.org/#45 | |
// by Perry Stoll | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// http://tour.golang.org/#46 | |
// question - is this efficient? | |
// ie is range operator returning refs or copies of the string elements? | |
import ( | |
"tour/wc" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://tour.golang.org/#48 | |
// | |
package main | |
import "fmt" | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
prev := 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "math/cmplx" | |
func Cbrt(x complex128) complex128 { | |
z:=complex128(1.0) | |
min_delta := float64(0.00000000001) | |
delta := complex128(1.0) | |
var iter int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env escript | |
%%! -hidden -noshell -noinput | |
-mode(compile). | |
-export([ | |
init_shell_log/1 | |
]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/http/ngx_http_variables.c.orig 2010-01-11 03:21:46.000000000 -0800 | |
+++ src/http/ngx_http_variables.c 2010-02-18 10:01:32.000000000 -0800 | |
@@ -93,6 +93,9 @@ | |
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r, | |
ngx_http_variable_value_t *v, uintptr_t data); | |
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r, | |
+ ngx_http_variable_value_t *v, uintptr_t data); | |
+ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/setup.py b/setup.py | |
index b8b003b..e8bf426 100644 | |
--- a/setup.py | |
+++ b/setup.py | |
@@ -1,9 +1,16 @@ | |
from setuptools import setup, Extension | |
from glob import glob | |
+import os | |
+ | |
+os.environ["CC"] = "/usr/local/bin/clang-omp -fopenmp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pstoll$ python test.py | |
test1 arrays: 6.956779105006717 | |
test1a arrays: 6.8869501760054845 | |
test2 native vectors: 59.97818154899869 | |
test2a native vectors: 90.65342697499727 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python test.py | |
test1arr for 100000000 primes: write directly to array with new generate_n_primes_array 2.82 sec | |
test1iter for 100000000 primes: write to numpy data using iter interface: 3.65 sec | |
test1iter2 for 100000000 primes: write to numpy data using iter interface data access: 3.40 sec | |
test1np for 100000000 primes: use normal vector generation but copy directly to numpy on output: 4.16 sec | |
test2 for 100000000 primes: current vector generate_n_primes with numpy copy from vector to output list: 21.03 sec | |
test2a for 100000000 primes: current vector, copy to output list, create numpy array: 36.25 sec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 10B values using new prime generation interface directly to numpy arrays | |
# total time - 1m:43sec for the entire calculation. | |
# prime generation was only 10 sec. | |
# it all fit in RAM for my 16GB machine. | |
prime-hexagon pstoll$ python ./primespin.py --nvalues=$(echo 10,000,000,000|tr -d ,) --chunks 10 --skip 1000000 | |
2015-11-18 02:08:34,722 - prime_hex - INFO - starting generating primes from 1 to 10000000000 | |
trying direct numpy prime generation... | |
2015-11-18 02:08:44,534 - prime_hex - INFO - done generating primes | |
2015-11-18 02:08:44,534 - prime_hex - INFO - compute_spins: generating mod6Values | |
2015-11-18 02:09:04,147 - prime_hex - INFO - compute_spins: done mod6Values |
OlderNewer