Changeset: 68cb0410379a for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=68cb0410379a Modified Files: monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh Branch: pyapi Log Message:
Added numpy memory map benchmark. diffs (72 lines): diff --git a/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py b/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py --- a/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py +++ b/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py @@ -545,6 +545,7 @@ else: database_load() for i in range(0,test_count): + os.system('/home/mytherin/bin/flushcache') start = time.time() database_execute() end = time.time() @@ -719,7 +720,30 @@ else: elif str(args_input_database).lower() == "castra": print("Not implemented") elif str(args_input_database).lower() == "numpymemorymap": - print("Not implemented") + import csv, numpy + numpy_binary = 'tempfile.npy' + def numpy_init(): + return None + + def numpy_load(): + with open(input_file, 'rb') as csvfile: + reader = csv.reader(csvfile) + result = [x for x in reader] + numpy_array = numpy.array(result, dtype=numpy.int32) + numpy.save(numpy_binary, numpy_array) + + def numpy_execute(): + numpy_array = numpy.memmap(numpy_binary, dtype=numpy.int32) + function(numpy_array) + + def numpy_clear(): + return None + + def numpy_final(): + os.remove(input_file) + os.remove(numpy_binary) + + execute_test(input_type, numpy_init, numpy_load, numpy_execute, numpy_clear, numpy_final) elif str(args_input_database).lower() == "monetdbembedded": import monetdb, csv @@ -736,7 +760,7 @@ else: def monetdbembedded_execute(): result = monetdb.sql('SELECT * FROM integers') - print(function(result['i'])) + function(result['i']) def monetdbembedded_clear(): monetdb.sql('DROP TABLE integers') diff --git a/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh b/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh --- a/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh +++ b/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh @@ -1,7 +1,7 @@ - + # The base directory of testing, a new folder is created in this base directory [$PYAPI_TEST_DIR], and everything is done in that new folder -export PYAPI_BASE_DIR=/export/scratch1/raasveld +export PYAPI_BASE_DIR=/home/mytherin # The terminal to start mserver with, examples are gnome-terminal, xterm, konsole export TERMINAL=x-terminal-emulator # Port used by the MSERVER @@ -522,3 +522,6 @@ function monetdbembedded_test() { python_run_single_test MONETDBEMBEDDED IDENTITY monetdbembedded_identity $IDENTITY_NTESTS "$IDENTITY_SIZES" } +function numpymmap_test() { + python_run_single_test NUMPYMEMORYMAP IDENTITY numpymmap_identity $IDENTITY_NTESTS "$IDENTITY_SIZES" +} _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list