Changeset: 59fc47cc6af5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=59fc47cc6af5
Modified Files:
        monetdb5/extras/pyapi/Benchmarks/graph.py
        monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py
        monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh
        monetdb5/extras/pyapi/pyapi.c
        monetdb5/extras/pyapi/pyapi.h
Branch: pyapi
Log Message:

Added LazyArray testcase.


diffs (213 lines):

diff --git a/monetdb5/extras/pyapi/Benchmarks/graph.py 
b/monetdb5/extras/pyapi/Benchmarks/graph.py
old mode 100644
new mode 100755
--- a/monetdb5/extras/pyapi/Benchmarks/graph.py
+++ b/monetdb5/extras/pyapi/Benchmarks/graph.py
@@ -182,8 +182,17 @@ else:
     def plot_graphs(graph_data, title, subtitle = "", index = 0):
         if index == len(sorted_indices) - 1:
             if len(subtitle) > 0: subtitle = '\n' + subtitle[:len(subtitle)-1]
+            plot_axis = dict()
+            graph_count = 0
             for m in range(0, measurements):
-                ax0 = plt.subplot(measurements, 1, m)
+                if y_axis[m] != "PyAPI Time (s)": graph_count = graph_count + 1
+            for m in range(0, measurements):
+                if y_axis[m] == "PyAPI Time (s)": continue
+                ax0 = plt.subplot(graph_count + 1, 1, m)
+                plot_axis[y_axis[m]] = ax0
+            for m in range(0, measurements):
+                if y_axis[m] != "PyAPI Time (s)": continue
+                ax0 = plot_axis['Total Time (s)']
                 j = 0
                 for dictionary in graph_data:
                     x_data = sorted(dictionary.keys())
@@ -192,15 +201,32 @@ else:
                     for x_value in x_data:
                         list.append(y_data, dictionary[x_value]['mean' + 
str(m)])
                         list.append(y_std, dictionary[x_value]['std' + str(m)])
-                    ax0.errorbar(x_data, y_data, yerr=y_std, fmt='-o', 
label=file_titles[j])
+                    ax0.plot(x_data, y_data, color=graph_colors[j])
+                    ax0.fill_between(x=x_data, y1=y_data, y2=1e-6, 
color=graph_colors[j], alpha=0.5)
+                    j += 1
+            for m in range(0, measurements):
+                if y_axis[m] == "PyAPI Time (s)": continue
+                ax0 = plot_axis[y_axis[m]]
+                j = 0
+                for dictionary in graph_data:
+                    x_data = sorted(dictionary.keys())
+                    y_data = []
+                    y_std = []
+                    for x_value in x_data:
+                        list.append(y_data, dictionary[x_value]['mean' + 
str(m)])
+                        list.append(y_std, dictionary[x_value]['std' + str(m)])
+                    ax0.errorbar(x_data, y_data, yerr=y_std, fmt='-o', 
label=file_titles[j], lw=2)
+                    if y_axis[m] == 'Total Time (s)':
+                        if fill_time:
+                            ax0.fill_between(x=x_data, y1=y_data, y2=1e-6, 
color=graph_colors[j], alpha=0.2)
                     j += 1
                 if x_log: ax0.set_xscale('log')
                 if y_log: ax0.set_yscale('log')
                 if m == 1 or measurements == 1: ax0.set_title(title + subtitle)
-                plt.xlabel(x_axis)
-                plt.ylabel(y_axis[m])
+                ax0.set_xlabel(x_axis)
+                ax0.set_ylabel(y_axis[m])
                 box = ax0.get_position()
-                ax0.set_position([box.x0, box.y0, box.width * 0.8, box.height])
+                ax0.set_position([box.x0, box.y0, box.width * 0.7, box.height])
                 # Put a legend below current axis
                 ax0.legend(loc='center left', bbox_to_anchor=(1, 0.5))
             if action.lower() == 'save':
@@ -214,6 +240,41 @@ else:
                 for graph in graph_data:
                     list.append(new_graph_data, graph[key])
                 plot_graphs(new_graph_data, title, subtitle + 
format_subtitle(axis[sorted_indices[index]], key) + ",",index + 1)
+    # def plot_graphs(graph_data, title, subtitle = "", index = 0):
+    #     if index == len(sorted_indices) - 1:
+    #         if len(subtitle) > 0: subtitle = '\n' + 
subtitle[:len(subtitle)-1]
+    #         for m in range(0, measurements):
+    #             ax0 = plt.subplot(measurements, 1, m)
+    #             j = 0
+    #             for dictionary in graph_data:
+    #                 x_data = sorted(dictionary.keys())
+    #                 y_data = []
+    #                 y_std = []
+    #                 for x_value in x_data:
+    #                     list.append(y_data, dictionary[x_value]['mean' + 
str(m)])
+    #                     list.append(y_std, dictionary[x_value]['std' + 
str(m)])
+    #                 ax0.errorbar(x_data, y_data, yerr=y_std, fmt='-o', 
label=file_titles[j])
+    #                 j += 1
+    #             if x_log: ax0.set_xscale('log')
+    #             if y_log: ax0.set_yscale('log')
+    #             if m == 1 or measurements == 1: ax0.set_title(title + 
subtitle)
+    #             plt.xlabel(x_axis)
+    #             plt.ylabel(y_axis[m])
+    #             box = ax0.get_position()
+    #             ax0.set_position([box.x0, box.y0, box.width * 0.8, 
box.height])
+    #             # Put a legend below current axis
+    #             ax0.legend(loc='center left', bbox_to_anchor=(1, 0.5))
+    #         if action.lower() == 'save':
+    #             plt.savefig((title + subtitle + '.pdf').translate(None, 
'\n'), format="pdf")
+    #             plt.close()
+    #         else:
+    #             plt.show()
+    #     else:
+    #         for key in graph_data[0].keys():
+    #             new_graph_data = []
+    #             for graph in graph_data:
+    #                 list.append(new_graph_data, graph[key])
+    #             plot_graphs(new_graph_data, title, subtitle + 
format_subtitle(axis[sorted_indices[index]], key) + ",",index + 1)
 
 plot_graphs(graph_data, graph_title)
 
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
@@ -479,12 +479,6 @@ elif "factorial" in str(arguments[1]).lo
             f.write(format_output(cores, size, results[0][i], results[1][i], 
results[2][i]))
             f.flush()
 
-        # result_file = open(temp_file, 'r')
-        # result_file.readline()
-        # for result in results:
-        #     pyapi_results = result_file.readline().translate(None, 
'\n').split('\t')
-        #     f.write(format_output(cores, size, result, 
float(pyapi_results[0]) / 1000**2, pyapi_results[1]))
-        #     f.flush()
         cursor.execute('drop table integers;')
     f.close()
 
diff --git a/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh 
b/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh
old mode 100644
new mode 100755
--- a/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh
+++ b/monetdb5/extras/pyapi/Benchmarks/pyapi_test.sh
@@ -4,25 +4,26 @@
 export PYAPI_BASE_DIR=$HOME
 # The terminal to start mserver with, examples are 'gnome-terminal', 'xterm', 
'konsole'
 export TERMINAL=x-terminal-emulator
+# Port used by the MSERVER
 export MSERVER_PORT=49979
 # A command that tests if the mserver is still running (used to find out when 
the shutting down of mserver is completed)
 export MSERVERTEST='netstat -ant | grep 
"127.0.0.1:$MSERVER_PORT.*LISTEN">/dev/null'
 # Testing parameters
 # Input test (zero copy vs copy)
 # The input sizes to test (in MB)
-export INPUT_TESTING_SIZES="0.1 1 10 100 1000"
+export INPUT_TESTING_SIZES="0.1 1 10 100 1000 10000"
 # Amount of tests to run for each size
 export INPUT_TESTING_NTESTS=10
 
 # Output test (zero copy vs copy)
 # The output sizes to test (in MB)
-export OUTPUT_TESTING_SIZES="0.1 1 10 100 1000"
+export OUTPUT_TESTING_SIZES="0.1 1 10 100 1000 10000"
 # Amount of tests to run for each size
 export OUTPUT_TESTING_NTESTS=10
 
 # String tests
 # Strings of the same length (mb, length)
-export STRINGSAMELENGTH_TESTING_SIZES="(100,1) (100,10) (100,100) (100,1000) 
(100,1000) (100,10000) (100,100000)"
+export STRINGSAMELENGTH_TESTING_SIZES="(1000,1) (1000,10) (1000,100) 
(1000,1000) (1000,1000) (1000,10000) (1000,100000)"
 export STRINGSAMELENGTH_TESTING_NTESTS=10
 # Extreme length string testing (all strings have length 1 except for one 
string, which has EXTREME length)
 # Arguments are (Extreme Length, String Count)
@@ -36,11 +37,11 @@ export STRINGUNICODE_TESTING_NTESTS=10
 export MULTITHREADING_NR_THREADS="1 2 3 4 5 6 7 8"
 export MULTITHREADING_TESTING_SIZES="1"
 #amount of tests for each thread
-export MULTITHREADING_TESTING_NTESTS=1
+export MULTITHREADING_TESTING_NTESTS=10
 
 # Quantile speedtest
 # The input sizes to test (in MB)
-export QUANTILE_TESTING_SIZES="0.1 1 10 100 1000"
+export QUANTILE_TESTING_SIZES="0.1 1 10 100 1000 10000"
 # Amount of tests to run for each size
 export QUANTILE_TESTING_NTESTS=10
 
@@ -48,6 +49,7 @@ export QUANTILE_TESTING_NTESTS=10
 # You probably don't need to change these
 export PYAPI_TEST_DIR=$PYAPI_BASE_DIR/monetdb_pyapi_test
 export PYAPI_MONETDB_DIR=$PYAPI_TEST_DIR/MonetDB-pyapi
+export PYAPI_SRC_DIR=$PYAPI_MONETDB_DIR/monetdb5/extras/pyapi
 export PYAPI_BUILD_DIR=$PYAPI_TEST_DIR/build
 export PYAPI_OUTPUT_DIR=$PYAPI_TEST_DIR/output
 # PyAPI TAR url
@@ -122,7 +124,7 @@ function pyapi_build {
         fi
     fi
     echo "Finished testing for libraries. Downloading and installing MonetDB."
-    wget $PYAPI_TAR_URL && tar xvzf pyapi.tar.gz && cd $PYAPI_MONETDB_DIR && 
./bootstrap && ./configure prefix=$PYAPI_BUILD_DIR --enable-debug=no 
--enable-assert=no --enable-optimize=yes && make -j install
+    wget $PYAPI_TAR_URL && tar xvzf pyapi.tar.gz && cd $PYAPI_MONETDB_DIR && 
printf '#ifndef _PYAPI_TESTING_\n#define _PYAPI_TESTING_\n#endif\n' | cat - 
$PYAPI_SRC_DIR/pyapi.h > $PYAPI_SRC_DIR/temp && mv $PYAPI_SRC_DIR/temp 
$PYAPI_SRC_DIR/pyapi.h && ./bootstrap && ./configure prefix=$PYAPI_BUILD_DIR 
--enable-debug=no --enable-assert=no --enable-optimize=yes && make -j install
     if [ $? -ne 0 ]; then
         echo "Failed to download and install MonetDB. Exiting..."
         return 1
diff --git a/monetdb5/extras/pyapi/pyapi.c b/monetdb5/extras/pyapi/pyapi.c
--- a/monetdb5/extras/pyapi/pyapi.c
+++ b/monetdb5/extras/pyapi/pyapi.c
@@ -1808,7 +1808,6 @@ PyObject *PyArrayObject_FromBAT(PyInput 
         BAT_TO_NP(b, dbl, NPY_FLOAT64);
         break;
     case TYPE_str:
-        option_numpy_string_array = true;
     #ifdef _PYAPI_TESTING_
         if (option_numpy_string_array) {
             bool unicode = false;
diff --git a/monetdb5/extras/pyapi/pyapi.h b/monetdb5/extras/pyapi/pyapi.h
--- a/monetdb5/extras/pyapi/pyapi.h
+++ b/monetdb5/extras/pyapi/pyapi.h
@@ -1,3 +1,4 @@
+
 /*
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
@@ -25,8 +26,6 @@
 #define _PYAPI_WARNINGS_
 // Enable debug mode, does literally nothing right now, but hey we have this 
nice #define here anyway
 #define _PYAPI_DEBUG_
-// Enable testing, if this #define is set you can use a bunch of testing flags 
to enable/disable certain optimizations
-#define _PYAPI_TESTING_
 #endif
 
 #ifdef _PYAPI_VERBOSE_
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to