Commits

Anonymous committed 6439d2b

runall.sh calls python directly, instead of calling it via make

Comments (0)

Files changed (4)

-run: libifnet_a2a2.so
-	python run_ifnet_a2a2.py
-
 libifnet_a2a2.so: ifnet_a2a2.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -Wall -std=c99 -shared $< -o $@
 
+import ctypes
+import numpy
+
+NUM_N = 100
+NUM_S = 2
+
+int1d = ctypes.POINTER(ctypes.c_int)
+double1d = ctypes.POINTER(ctypes.c_double)
+## c_double_p = ctypes.POINTER(ctypes.c_double)
+## c_int_p = ctypes.POINTER(ctypes.c_int)
+
+
+class IFNetAllToAll2Struct(ctypes.Structure):
+    _fields_ = [
+        ("num_n", ctypes.c_int),
+        ("num_s", ctypes.c_int),
+        ("num_k", ctypes.c_int),
+        ("dt", ctypes.c_double),
+        ("ie", ctypes.c_double),
+        ("gl", ctypes.c_double),
+        ("isyn", ctypes.c_double),
+        ("vrest", ctypes.c_double),
+        ("th", ctypes.c_double),
+        ("ssyn", ctypes.c_double),
+        ("tau1", ctypes.c_double),
+        ("tau2", ctypes.c_double),
+        ("lmd1", ctypes.c_double),
+        ("lmd2", ctypes.c_double),
+        ("k1_mean", ctypes.c_double),
+        ("k2_mean", ctypes.c_double),
+        ("fired", int1d),
+        ("total_spikes", int1d),
+        ("rec_sspike", ctypes.c_void_p),
+        ("rec_fired", ctypes.c_void_p),
+        ("vi", double1d),
+        ("v0", double1d),
+        ("k1", double1d),
+        ("k2", double1d),
+        ("lspike", double1d),
+        ("rec_isyn", double1d),
+        ("rec_vi", ctypes.c_void_p),
+        ("rec_lspike", ctypes.c_void_p),
+        ]
+
+
+IFNetAllToAll2Struct_p = ctypes.POINTER(IFNetAllToAll2Struct)
+
+ifnet_a2a2 = numpy.ctypeslib.load_library('libifnet_a2a2.so', '.')
+ifnet_a2a2.IFNetAllToAll2_init.restype = ctypes.c_int
+ifnet_a2a2.IFNetAllToAll2_init.argtypes = [IFNetAllToAll2Struct_p]
+ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2.restype = ctypes.c_int
+ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2.argtypes = [IFNetAllToAll2Struct_p]
+
+
+def init(struct):
+    ifnet_a2a2.IFNetAllToAll2_init(ctypes.pointer(struct))
+
+
+def vec_v0_rk2(struct):
+    ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2(ctypes.pointer(struct))
+
+
+if __name__ == '__main__':
+    ifn = IFNetAllToAll2Struct(
+        num_n=NUM_N, num_s=NUM_S, dt=0.1, gl=0.1, vrest=-60, ie=-3.7, th=-40,
+        ssyn=0.5, tau1=3, tau2=1,
+        )
+    ifn.num_k = ifn.num_s
+    v0 = numpy.zeros(ifn.num_n, dtype=float)
+    vi = numpy.zeros(ifn.num_n, dtype=float)
+    ifn.v0 = v0.ctypes.data_as(double1d)
+    ifn.vi = vi.ctypes.data_as(double1d)
+
+    init(ifn)
+    vec_v0_rk2(ifn)
+
+    v0 + vi

run_ifnet_a2a2.py

-import ctypes
-import numpy
-
-NUM_N = 100
-NUM_S = 2
-
-int1d = ctypes.POINTER(ctypes.c_int)
-double1d = ctypes.POINTER(ctypes.c_double)
-## c_double_p = ctypes.POINTER(ctypes.c_double)
-## c_int_p = ctypes.POINTER(ctypes.c_int)
-
-
-class IFNetAllToAll2Struct(ctypes.Structure):
-    _fields_ = [
-        ("num_n", ctypes.c_int),
-        ("num_s", ctypes.c_int),
-        ("num_k", ctypes.c_int),
-        ("dt", ctypes.c_double),
-        ("ie", ctypes.c_double),
-        ("gl", ctypes.c_double),
-        ("isyn", ctypes.c_double),
-        ("vrest", ctypes.c_double),
-        ("th", ctypes.c_double),
-        ("ssyn", ctypes.c_double),
-        ("tau1", ctypes.c_double),
-        ("tau2", ctypes.c_double),
-        ("lmd1", ctypes.c_double),
-        ("lmd2", ctypes.c_double),
-        ("k1_mean", ctypes.c_double),
-        ("k2_mean", ctypes.c_double),
-        ("fired", int1d),
-        ("total_spikes", int1d),
-        ("rec_sspike", ctypes.c_void_p),
-        ("rec_fired", ctypes.c_void_p),
-        ("vi", double1d),
-        ("v0", double1d),
-        ("k1", double1d),
-        ("k2", double1d),
-        ("lspike", double1d),
-        ("rec_isyn", double1d),
-        ("rec_vi", ctypes.c_void_p),
-        ("rec_lspike", ctypes.c_void_p),
-        ]
-
-
-IFNetAllToAll2Struct_p = ctypes.POINTER(IFNetAllToAll2Struct)
-
-ifnet_a2a2 = numpy.ctypeslib.load_library('libifnet_a2a2.so', '.')
-ifnet_a2a2.IFNetAllToAll2_init.restype = ctypes.c_int
-ifnet_a2a2.IFNetAllToAll2_init.argtypes = [IFNetAllToAll2Struct_p]
-ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2.restype = ctypes.c_int
-ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2.argtypes = [IFNetAllToAll2Struct_p]
-
-
-def init(struct):
-    ifnet_a2a2.IFNetAllToAll2_init(ctypes.pointer(struct))
-
-
-def vec_v0_rk2(struct):
-    ifnet_a2a2.IFNetAllToAll2_vec_v0_rk2(ctypes.pointer(struct))
-
-
-if __name__ == '__main__':
-    ifn = IFNetAllToAll2Struct(
-        num_n=NUM_N, num_s=NUM_S, dt=0.1, gl=0.1, vrest=-60, ie=-3.7, th=-40,
-        ssyn=0.5, tau1=3, tau2=1,
-        )
-    ifn.num_k = ifn.num_s
-    v0 = numpy.zeros(ifn.num_n, dtype=float)
-    vi = numpy.zeros(ifn.num_n, dtype=float)
-    ifn.v0 = v0.ctypes.data_as(double1d)
-    ifn.vi = vi.ctypes.data_as(double1d)
-
-    init(ifn)
-    vec_v0_rk2(ifn)
-
-    v0 + vi
 rm "$exitcode"
 
 run(){
-    make clean && CC=$1 CFLAGS="$CFLAGS $2" make
+    make clean && CC=$1 CFLAGS=$2 make && python run.py
     echo "$1 $2: $?" >> "$exitcode"
 }
 
 run gcc -O0
 run gcc -O1
+run gcc -O2
 run gcc -O3
 run icc -O0
 run icc -O1
+run icc -O2
 run icc -O3
+
+echo
+echo "Result (see $exitcode):"
+cat "$exitcode"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.