antonmks / Alenka

GPU database engine
Other
1.17k stars 120 forks source link

Alenka crash when executing for q2.sql, q3.sql, q5.sql, and q7.sql #40

Closed wanahmadzainie closed 11 years ago

wanahmadzainie commented 11 years ago

Hi.

I managed to build Alenka on Linux machine, Ubuntu 12.04 64-bit. However the application crash when executing for the above sql. I had pasted what I see on my my console below.

Please advice. I am at my wit end. Thanks.

EDITED:- I created the table using $ dbgen -n 10000 -o dbgen.tbl and then create symbolic link to dbgen.tbl for every unfound .tbl file return by executing $ ./alenka load_XXXXX.sql

ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q1.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: A lineitem Reading 380033 records opening lineitem.sort FILTER B A 2736513024 MAP CHECK segment 0 A filter is finished 380033 2734940160 filter time 0 2736513024 SELECT D B 2736513024 segment 0 select mem 2733367296 final select 2 select time 0.06 STORE: D mytest.txt | SQL scan parse worked cycle time 0.06 ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q2.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: N nation Reading 380033 records opening nation.sort BINARY LOAD: R region Reading 380033 records opening region.sort FILTER RF R 2736513024 MAP CHECK segment 0 R filter is finished 0 2734940160 filter time 0.01 2736513024 BINARY LOAD: S supplier Reading 380033 records opening supplier.sort BINARY LOAD: PS partsupp Reading 380033 records opening partsupp.sort BINARY LOAD: P part Reading 380033 records opening part.sort FILTER PF P 2736513024 terminate called after throwing an instance of 'thrust::system::detail::bad_alloc' what(): std::bad_alloc: unspecified launch failure Aborted (core dumped) ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q3.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: O orders Reading 380033 records opening orders.sort FILTER OFI O 2736513024 MAP CHECK segment 0 A filter is finished 380033 2734940160 filter time 0.01 2736513024 BINARY LOAD: C customer Reading 0 records opening customer.sort filter time 0 2736513024 BINARY LOAD: L lineitem Reading 380033 records opening lineitem.sort FILTER LF L 2736513024 MAP CHECK segment 0 N filter is finished 0 2734940160 filter time 0.01 2736513024 JOIN OLC1 o_custkey c_custkey 2736513024 Join result OLC : 0 Segmentation fault (core dumped) ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q5.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: R region Reading 380033 records opening region.sort FILTER RF R 2736513024 MAP CHECK segment 0 R filter is finished 0 2734940160 filter time 0.01 2736513024 BINARY LOAD: N nation Reading 380033 records opening nation.sort BINARY LOAD: O orders Reading 380033 records opening orders.sort FILTER OFI O 2736513024 MAP CHECK segment 0 N filter is finished 0 2734940160 filter time 0 2736513024 BINARY LOAD: S supplier Reading 380033 records opening supplier.sort BINARY LOAD: C customer Reading 0 records opening customer.sort BINARY LOAD: L lineitem Reading 380033 records opening lineitem.sort JOIN J11 n_regionkey r_regionkey 2736513024 Join result J1 : 0 Segmentation fault (core dumped) ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q6.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: A lineitem Reading 380033 records opening lineitem.sort FILTER B A 2736513024 MAP CHECK segment 0 N filter is finished 0 2734940160 filter time 0 2736513024 SELECT C count : 0, Mem 2736513024 STORE: C mytest.txt | SQL scan parse worked cycle time 0.01 ubuntu@ubuntuserv:~/workspace/Alenka-master$ ./alenka q7.sql Tesla C2050 : 1147.000 Mhz (Ordinal 0) 14 SMs enabled. Compute Capability sm_20 FreeMem: 2610MB TotalMem: 2687MB. Mem Clock: 1500.000 Mhz x 384 bits (144.000 GB/s) ECC Enabled

Process count = 6200000 BINARY LOAD: L lineitem Reading 380033 records opening lineitem.sort FILTER LF L 2736513024 MAP CHECK segment 0 N filter is finished 0 2734940160 filter time 0 2736513024 BINARY LOAD: S supplier Reading 380033 records opening supplier.sort BINARY LOAD: C customer Reading 0 records opening customer.sort BINARY LOAD: N nation Reading 380033 records opening nation.sort FILTER NF N 2736513024 MAP CHECK segment 0 R filter is finished 0 2734940160 filter time 0.01 2736513024 BINARY LOAD: N1 nation Reading 380033 records opening nation.sort FILTER NF1 N1 2736513024 MAP CHECK segment 0 R filter is finished 0 2734940160 filter time 0.01 2736513024 BINARY LOAD: O orders Reading 380033 records opening orders.sort JOIN SN s_nationkey n_nationkey1 2736513024 Join result SN : 0 Segmentation fault (core dumped) ubuntu@ubuntuserv:~/workspace/Alenka-master$ ubuntu@ubuntuserv:~/workspace/Alenka-master$ uname -a Linux ubuntuserv 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu Jun 20 18:21:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux ubuntu@ubuntuserv:~/workspace/Alenka-master$ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2012 NVIDIA Corporation Built on Fri_Sep_21_17:28:58_PDT_2012 Cuda compilation tools, release 5.0, V0.2.1221 ubuntu@ubuntuserv:~/workspace/Alenka-master$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.4-1ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) ubuntu@ubuntuserv:~/workspace/Alenka-master$

antonmks commented 11 years ago

Check if you have any records in customer file, looks like it is reading 0 records.

wanahmadzainie commented 11 years ago

Hi.

I had created a patch file which solve my problem here. Hope you will find it useful. I had tested it against the same machine.

Thank you.

diff -Naur Alenka-master.orig/bison.cu Alenka-master/bison.cu
--- Alenka-master.orig/bison.cu 2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/bison.cu  2013-07-18 11:49:05.330949304 +0800
@@ -3168,11 +3168,13 @@
                    op_join.pop();
                }
                else {
-                   if(!op_join.empty())
-                       j = op_join.front();    
+                   if(!op_join.empty()) {
+                       j = op_join.front();
+                       op_join.pop();
+                   }
                    else
                        j = j1;           
-                   op_join.pop();
+                   //op_join.pop();
                    j2 = s + to_string1((long long int)i-1);
                };
                emit_multijoin(tab_name, j, j2, i, s);
@@ -3198,7 +3200,7 @@
         varNames.erase(j1);
     };

-    if(stat[op_join.front()] == statement_count && op_join.front().compare(j1) != 0) {
+    if(!op_join.empty() && stat[op_join.front()] == statement_count && op_join.front().compare(j1) != 0) {
         varNames[op_join.front()]->free();
         varNames.erase(op_join.front());
     };
diff -Naur Alenka-master.orig/cm.cu Alenka-master/cm.cu
--- Alenka-master.orig/cm.cu    2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/cm.cu 2013-07-18 11:47:50.146947587 +0800
@@ -20,7 +20,7 @@
 #include "atof.h"
 #include "compress.cu"
 #include "sorts.cu"
-
+#include <algorithm>

 #ifdef _WIN64
@@ -738,6 +738,7 @@
     }
     else {
         decompress_char(f, colIndex, segNum);
+   return 0;
     };

     fclose(f);
@@ -2182,7 +2183,7 @@
         else if ((typeRef.front()).compare("float") == 0) {
             type[i] = 1;
             decimal[i] = 0;
-            h_columns_float.push_back(thrust::host_vector<float_type, pinned_allocator<float_type>>());
+            h_columns_float.push_back(thrust::host_vector<float_type, pinned_allocator<float_type> >());
             d_columns_float.push_back(thrust::device_vector<float_type>());
             type_index[i] = h_columns_float.size()-1;
         }
@@ -2272,7 +2273,7 @@
         }
         else if ((a->type)[index] == 1) {
             d_columns_float.push_back(thrust::device_vector<float_type>());
-            h_columns_float.push_back(thrust::host_vector<float_type, pinned_allocator<float_type>>());
+            h_columns_float.push_back(thrust::host_vector<float_type, pinned_allocator<float_type> >());
             type[i] = 1;
             type_index[i] = h_columns_float.size()-1;
         }
diff -Naur Alenka-master.orig/Makefile Alenka-master/Makefile
--- Alenka-master.orig/Makefile 2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/Makefile  2013-07-18 11:47:50.146947587 +0800
@@ -1,16 +1,16 @@
 alenka : bison.o merge.o \
          MurmurHash2_64.o filter.o \
-        strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
-        select.o zone_map.o itoa.o \
-        atof.o cm.o mgpucontext.o format.o
-   /usr/local/cuda/bin/nvcc -O3 -arch=sm_20 -lcuda -lcudpp64 -lcudpp_hash64 -o alenka bison.o merge.o \
-         MurmurHash2_64.o filter.o \
-        strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
-        select.o zone_map.o itoa.o \
-        atof.o cm.o mgpucontext.o format.o
+    strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
+    select.o zone_map.o itoa.o \
+    atof.o cm.o mgpucontext.o format.o
+   /usr/local/cuda/bin/nvcc -O3 -arch=sm_20 -lcuda -Lcudpp_src_2.0/lib -lcudpp64 -lcudpp_hash64 -o alenka bison.o merge.o \
+   MurmurHash2_64.o filter.o \
+   strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
+   select.o zone_map.o itoa.o \
+   atof.o cm.o mgpucontext.o format.o

-nvcc = /usr/local/cuda/bin/nvcc --machine 64 -O3 -arch=sm_20 -c
+nvcc = /usr/local/cuda/bin/nvcc --machine 64 -O3 -arch=sm_20 -c -Iinclude

 bison.o : bison.cu cm.h sorts.cu
    $(nvcc) bison.cu
@@ -38,13 +38,14 @@
    $(nvcc) atof.cu 
 cm.o : cm.cu cm.h  
    $(nvcc) cm.cu
-mgpucontext.obj : moderngpu-master/src/mgpucontext.cpp     
-   $(nvcc) moderngpu-master/src/mgpucontext.cpp
-format.obj : moderngpu-master/src/format.cpp   
-   $(nvcc) moderngpu-master/src/format.cpp 
+mgpucontext.o : moderngpu-master/src/mgpucontext.cpp   
+   $(nvcc) -Imoderngpu-master/include moderngpu-master/src/mgpucontext.cpp
+format.o : moderngpu-master/src/format.cpp     
+   $(nvcc) -Imoderngpu-master/include moderngpu-master/src/format.cpp  

-clean : del bison.o merge.o \
-         MurmurHash2_64.o filter.o \
-        strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
-        select.o zone_map.o itoa.o \
-        atof.o cm.o mgpucontext.o format.o
\ No newline at end of file
+clean : 
+   rm -rf alenka bison.o merge.o \
+   MurmurHash2_64.o filter.o \
+   strings_filter.o strings_join.o strings_sort_host.o strings_sort_device.o \
+   select.o zone_map.o itoa.o \
+   atof.o cm.o mgpucontext.o format.o
diff -Naur Alenka-master.orig/merge.cu Alenka-master/merge.cu
--- Alenka-master.orig/merge.cu 2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/merge.cu  2013-07-18 11:47:50.146947587 +0800
@@ -57,13 +57,13 @@

        switch(*len & 7)
        {
-           case 7: h ^= unsigned long long(data2[6]) << 48;
-           case 6: h ^= unsigned long long(data2[5]) << 40;
-           case 5: h ^= unsigned long long(data2[4]) << 32;
-           case 4: h ^= unsigned long long(data2[3]) << 24;
-           case 3: h ^= unsigned long long(data2[2]) << 16;
-           case 2: h ^= unsigned long long(data2[1]) << 8;
-           case 1: h ^= unsigned long long(data2[0]);
+           case 7: h ^= (unsigned long long)(data2[6]) << 48;
+           case 6: h ^= (unsigned long long)(data2[5]) << 40;
+           case 5: h ^= (unsigned long long)(data2[4]) << 32;
+           case 4: h ^= (unsigned long long)(data2[3]) << 24;
+           case 3: h ^= (unsigned long long)(data2[2]) << 16;
+           case 2: h ^= (unsigned long long)(data2[1]) << 8;
+           case 1: h ^= (unsigned long long)(data2[0]);
            h *= m;
        };

@@ -116,13 +116,13 @@

        switch(*len & 7)
        {
-           case 7: h ^= unsigned long long(data2[6]) << 48;
-           case 6: h ^= unsigned long long(data2[5]) << 40;
-           case 5: h ^= unsigned long long(data2[4]) << 32;
-           case 4: h ^= unsigned long long(data2[3]) << 24;
-           case 3: h ^= unsigned long long(data2[2]) << 16;
-           case 2: h ^= unsigned long long(data2[1]) << 8;
-           case 1: h ^= unsigned long long(data2[0]);
+           case 7: h ^= (unsigned long long)(data2[6]) << 48;
+           case 6: h ^= (unsigned long long)(data2[5]) << 40;
+           case 5: h ^= (unsigned long long)(data2[4]) << 32;
+           case 4: h ^= (unsigned long long)(data2[3]) << 24;
+           case 3: h ^= (unsigned long long)(data2[2]) << 16;
+           case 2: h ^= (unsigned long long)(data2[1]) << 8;
+           case 1: h ^= (unsigned long long)(data2[0]);
            h *= m;
        };

diff -Naur Alenka-master.orig/strings_sort_device.cu Alenka-master/strings_sort_device.cu
--- Alenka-master.orig/strings_sort_device.cu   2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/strings_sort_device.cu    2013-07-18 11:47:50.146947587 +0800
@@ -88,7 +88,7 @@
 template<>
 struct T_str_sort<8> {
    inline void operator()(char* tmp, const size_t RecCount, thrust::device_ptr<unsigned int> &dev_per, const bool desc_order) {
-       static_assert(sizeof(unsigned long long) == 8, "The size of unsigned long long is not equal to 8 bytes. Comment out this functor!");
+       //static_assert(sizeof(unsigned long long) == 8, "The size of unsigned long long is not equal to 8 bytes. Comment out this functor!");
        optimized_str_sort<unsigned long long>(tmp, RecCount, dev_per, desc_order, T_swap_le_be_64());
    }
 };
@@ -97,7 +97,7 @@
 template<>
 struct T_str_sort<4> {
    inline void operator()(char* tmp, const size_t RecCount, thrust::device_ptr<unsigned int> &dev_per, const bool desc_order) {
-       static_assert(sizeof(unsigned int) == 4, "The size of unsigned int is not equal to 4 bytes. Comment out this functor!");
+       //static_assert(sizeof(unsigned int) == 4, "The size of unsigned int is not equal to 4 bytes. Comment out this functor!");
        optimized_str_sort<unsigned int>(tmp, RecCount, dev_per, desc_order, T_swap_le_be_32());
    }
 };
@@ -106,7 +106,7 @@
 template<>
 struct T_str_sort<2> {
    inline void operator()(char* tmp, const size_t RecCount, thrust::device_ptr<unsigned int> &dev_per, const bool desc_order) {
-       static_assert(sizeof(unsigned short int) == 2, "The size of unsigned short int is not equal to 2 bytes. Comment out this functor!");
+       //static_assert(sizeof(unsigned short int) == 2, "The size of unsigned short int is not equal to 2 bytes. Comment out this functor!");
        optimized_str_sort<unsigned short int>(tmp, RecCount, dev_per, desc_order, T_swap_le_be_16());
    }
 };
@@ -115,7 +115,7 @@
 template<>
 struct T_str_sort<1> {
    inline void operator()(char* tmp, const size_t RecCount, thrust::device_ptr<unsigned int> &dev_per, const bool desc_order) {
-       static_assert(sizeof(unsigned char) == 1, "The size of unsigned char is not equal to 1 bytes. Comment out this functor!");
+       //static_assert(sizeof(unsigned char) == 1, "The size of unsigned char is not equal to 1 bytes. Comment out this functor!");
        optimized_str_sort<unsigned char>(tmp, RecCount, dev_per, desc_order, T_swap_le_be_8());
    }
 };
diff -Naur Alenka-master.orig/strings_type.h Alenka-master/strings_type.h
--- Alenka-master.orig/strings_type.h   2013-07-04 19:58:26.000000000 +0800
+++ Alenka-master/strings_type.h    2013-07-18 11:47:50.150947588 +0800
@@ -49,7 +49,7 @@
    unsigned char comparison(const Str& other) const {
            if(size % 4 == 0) {
            /// Speedup in 3 - 3.5 times (compare aligned data by 4 bytes)
-           static_assert(sizeof(unsigned int) == 4, "You can't use this optimized class, because it can't compare data by 4 bytes!");
+           //static_assert(sizeof(unsigned int) == 4, "You can't use this optimized class, because it can't compare data by 4 bytes!");
            unsigned int const* data4_first = reinterpret_cast<unsigned int const*>(data);
            unsigned int const* data4_second = reinterpret_cast<unsigned int const *>(other.data);
            /// Unrolls loops is especially important for CUDA-pipelines
@@ -206,4 +206,4 @@
 // -----------------------------------------------------------------------

 //---------------------------------------------------------------------------
-#endif /// STRINGS_TYPE_H
\ No newline at end of file
+#endif /// STRINGS_TYPE_H
antonmks commented 11 years ago

Thank you ! A few issues already been fixed, the others I have merged with the current source.