#include #include #include /*#include */ /*#include */ using namespace std; #define SF 10 #define BASE_PATH "/home/ubuntu/Implementation-GPUDB/test/ssb/data/" #if SF == 1 #define DATA_DIR BASE_PATH "s1_columnar/" #define LO_LEN 6001171 #define P_LEN 200000 #define S_LEN 2000 #define C_LEN 30000 #define D_LEN 2556 #elif SF == 10 #define DATA_DIR BASE_PATH "s10_columnar/" #define LO_LEN 59986214 #define P_LEN 800000 #define S_LEN 20000 #define C_LEN 300000 #define D_LEN 2556 #else // 20 #define DATA_DIR BASE_PATH "s20_columnar/" #define LO_LEN 119994746 #define P_LEN 1000000 #define S_LEN 40000 #define C_LEN 600000 #define D_LEN 2556 #endif #define BATCH_SIZE 128 #define NUM_THREADS 128 int index_of(string* arr, int len, string val) { for (int i=0; i T* loadColumn(string col_name, int num_entries) { T* h_col = new T[num_entries]; string filename = DATA_DIR + lookup(col_name); ifstream colData (filename.c_str(), ios::in | ios::binary); if (!colData) { return NULL; } colData.read((char*)h_col, num_entries * sizeof(T)); return h_col; } template int storeColumn(string col_name, int num_entries, int* h_col) { string filename = DATA_DIR + lookup(col_name); ofstream colData (filename.c_str(), ios::out | ios::binary); if (!colData) { return -1; } colData.write((char*)h_col, num_entries * sizeof(T)); return 0; } /*int main() {*/ //int *h_col = new int[10]; //for (int i=0; i<10; i++) h_col[i] = i; //storeColumn("test", 10, h_col); //int *l_col = loadColumn("test", 10); //for (int i=0; i<10; i++) cout << l_col[i] << " "; //cout << endl; //return 0; /*}*/