Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
hilbertJoin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Perdacher
hilbertJoin
Commits
d750493a
Commit
d750493a
authored
Apr 08, 2019
by
Martin Perdacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v.0.99
parent
919ea2f5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
26 deletions
+95
-26
hilbertjoin/egojoin.cpp
hilbertjoin/egojoin.cpp
+2
-3
hilbertjoin/egojoin.h
hilbertjoin/egojoin.h
+1
-1
main.cpp
main.cpp
+6
-6
mainJoin.cpp
mainJoin.cpp
+27
-7
util/arguments.cpp
util/arguments.cpp
+2
-2
util/dataIo.cpp
util/dataIo.cpp
+56
-7
util/dataIo.h
util/dataIo.h
+1
-0
No files found.
hilbertjoin/egojoin.cpp
View file @
d750493a
...
...
@@ -838,7 +838,7 @@ void test_ego_loop3_macro(size_t n, size_t d, double epsilon, double *array, siz
// printf("%ld ",savedload[NUM_THREADS*s+par]);
}
int
test_ego_loop3_noself
(
const
size_t
nA
,
const
size_t
nB
,
const
int
d
,
const
double
epsilon
,
double
*
arrayA
,
double
*
arrayB
,
size_t
*
countresult
,
const
int
activedims
,
double
*
sortTime
,
double
*
indextime
,
double
*
loadpercent
){
void
test_ego_loop3_noself
(
const
size_t
nA
,
const
size_t
nB
,
const
int
d
,
const
double
epsilon
,
double
*
arrayA
,
double
*
arrayB
,
size_t
*
countresult
,
const
int
activedims
,
double
*
sortTime
,
double
*
indextime
,
double
*
loadpercent
){
CUtilTimer
index_timer
,
total_timer
,
sortTimer
;
long
long
result
=
0
;
long
long
refinements
=
0
;
...
...
@@ -904,8 +904,7 @@ int test_ego_loop3_noself(const size_t nA, const size_t nB, const int d, const d
// for(int par=0 ; par<NUM_THREADS ; par++, printf("\n"))
// for(int s=0 ; s<5 ; s++)
// printf("%ld ",savedload[NUM_THREADS*s+par]);
// printf("%ld ",savedload[NUM_THREADS*s+par]);
}
...
...
hilbertjoin/egojoin.h
View file @
d750493a
...
...
@@ -61,7 +61,7 @@ void outputStatistics(int n, int d, double epsilon, double *array, int *reorder_
void
sampleHistograms
(
int
n
,
int
d
,
double
epsilon
,
double
*
array
,
int
*
reorder_dim
);
void
prepareStripesNoSelf
(
int
nA
,
int
nB
,
int
d
,
int
activeDimensions
,
double
epsilon
,
double
*
A
,
double
*
B
,
int
**
lower
,
int
**
upper
,
double
*
selfA
,
double
*
selfB
);
int
test_ego_loop3_noself
(
const
size_t
nA
,
const
size_t
nB
,
const
int
d
,
const
double
epsilon
,
double
*
arrayA
,
double
*
arrayB
,
size_t
*
countresult
,
const
int
activedims
,
double
*
sortTime
,
double
*
indextime
,
double
*
loadpercent
);
void
test_ego_loop3_noself
(
const
size_t
nA
,
const
size_t
nB
,
const
int
d
,
const
double
epsilon
,
double
*
arrayA
,
double
*
arrayB
,
size_t
*
countresult
,
const
int
activedims
,
double
*
sortTime
,
double
*
indextime
,
double
*
loadpercent
);
#define hilbert_swap(i,j) {memcpy(b, (i), size); memcpy((i), (j), size); memcpy((j), b, size);}
#define hilbert_max(a,b) ((a)>(b) ? (a) : (b))
...
...
main.cpp
View file @
d750493a
...
...
@@ -70,12 +70,12 @@ int main(int argc, char** argv) {
read_file
(
array
,
n
,
d
,
filename
,
isBinary
);
// printf("readfile ok\n"); fflush(stdout);
//
for ( int i=0 ; i < 10 ; i++ ){
//
for ( int j=0 ; j < d ; j++ ){
//
printf("%f, ", array[i*d+j]);
//
}
//
printf("\n");
//
}
for
(
int
i
=
0
;
i
<
10
;
i
++
){
for
(
int
j
=
0
;
j
<
d
;
j
++
){
printf
(
"%f, "
,
array
[
i
*
d
+
j
]);
}
printf
(
"
\n
"
);
}
pmeter
.
reset
();
pmeter
.
start
();
timer
.
start
();
...
...
mainJoin.cpp
View file @
d750493a
...
...
@@ -58,18 +58,37 @@ int main(int argc, char** argv) {
double
*
x1
=
(
double
*
)
ddr_alloc
(
n
*
sizeof
(
double
)
*
d
+
16384
);
double
*
x2
=
(
double
*
)
ddr_alloc
(
m
*
sizeof
(
double
)
*
d
+
16384
);
if
(
strcmp
(
filename
,
""
)
==
0
)
{
random_init_unif
(
x1
,
n
,
d
,
1
);
}
else
{
read_file
(
x1
,
n
,
d
,
filename
,
isBinary
);
}
// if ( strcmp(filename,"" ) == 0) {
// // random_init_unif(x1,n,d,1);
// random_init_8_selective(x1,n,d,1);
// }else{
// read_file(x1, n, d, filename, isBinary);
// }
// char filenameA[256];
// sprintf(filenameA, "selective8_dims_A_%d_%d_normalized.bin", n,d);
// save_binary_file(x1, n, d, filenameA);
// printf("savedA\n");fflush(stdout);
if
(
strcmp
(
filename2
,
""
)
==
0
)
{
random_init_unif
(
x2
,
m
,
d
,
2
);
// random_init_unif(x2,m,d,2);
random_init_8_selective
(
x2
,
m
,
d
,
2
);
}
else
{
read_file
(
x2
,
m
,
d
,
filename
,
isBinary
);
}
// char filenameB[256];
// sprintf(filenameB, "selective8_dims_B_%d_%d_normalized.bin", m,d);
// save_binary_file(x2, m, d, filenameB);
// printf("savedB\n");fflush(stdout);
//
// for ( int i=m-3 ; i < m ; i++ ){
// for ( int j=0 ; j < d ; j++ ){
// printf("%f, ", x2[i*d+j] );
// }
// printf("\n");
// }
// pmeter.reset(); pmeter.start();
timer
.
start
();
...
...
@@ -87,6 +106,7 @@ int main(int argc, char** argv) {
algtimer
.
start
();
#ifdef COUNT_ONLY
test_ego_loop3_noself
(
n
,
m
,
d
,
epsilon
,
x1
,
x2
,
&
result
,
actdim
,
&
sortTime
,
&
indexTime
,
&
loadpercent
);
// test_ego_loop3_macro(n,d,epsilon,array,&result,stripes,&sortTime,&indexTime,&loadpercent);
// test_ego_loop3_macro(n,d,threads,epsilon,array,&result,stripes,&sortTime);
#else
...
...
@@ -113,7 +133,7 @@ int main(int argc, char** argv) {
double
jp_per_point
=
(
result
==
0
)
?
0
:
(
double
)
result
/
n
;
// HEADER:
// N;D;JPPP;THREADS;EPSILON;STRIPES;KBLOCK;TIME;ALGTIME;SORTTIME;INDEXTIME;REORDERTIME;COUNTS;LOADPERCENT;WH
printf
(
"%zu;%zu;%
f;%zu;%2.14f;%d;%d;%f;%f;%f;%f;%f;%ld;%f;%f
\n
"
,
n
,
d
,
jp_per_point
,
NUM_THREADS
,
epsilon
,
stripes
,
KBLOCK
,
algtime
+
reorderTime
,
algtime
-
sortTime
,
sortTime
,
indexTime
,
reorderTime
,
result
,
loadpercent
,
watthours
);
printf
(
"%zu;%zu;%
zu;%f;%zu;%2.14f;%d;%d;%f;%f;%f;%f;%f;%ld;%f;%f
\n
"
,
n
,
m
,
d
,
jp_per_point
,
NUM_THREADS
,
epsilon
,
stripes
,
KBLOCK
,
algtime
+
reorderTime
,
algtime
-
sortTime
,
sortTime
,
indexTime
,
reorderTime
,
result
,
loadpercent
,
watthours
);
ddr_free
(
x1
);
ddr_free
(
x2
);
...
...
util/arguments.cpp
View file @
d750493a
...
...
@@ -97,7 +97,7 @@ void parsing_args_join(int argc, char* argv[], size_t *n, size_t *m, double *eps
exit
(
1
);
}
while
(
(
c
=
getopt
(
argc
,
argv
,
"n:m:e:d:t:f:k:a:b"
)
)
!=
-
1
)
{
while
(
(
c
=
getopt
(
argc
,
argv
,
"n:m:e:d:t:f:
g:
k:a:b"
)
)
!=
-
1
)
{
if
(
optarg
){
switch
(
c
){
...
...
@@ -120,7 +120,7 @@ void parsing_args_join(int argc, char* argv[], size_t *n, size_t *m, double *eps
strcpy
(
filename
,
optarg
);
break
;
case
'g'
:
strcpy
(
filename
,
optarg
);
strcpy
(
filename
2
,
optarg
);
break
;
case
'?'
:
if
(
optopt
==
'c'
)
...
...
util/dataIo.cpp
View file @
d750493a
...
...
@@ -2,8 +2,7 @@
#include "dataIo.h"
void
random_init_unif
(
double
*
array
,
const
int
N
,
const
int
D
,
const
int
INIT_SEED
){
#pragma omp parallel
{
const
int
ME
=
omp_get_thread_num
();
const
int
ALL_THREADS
=
omp_get_num_threads
();
VSLStreamStatePtr
stream
;
...
...
@@ -18,18 +17,66 @@ void random_init_unif(double *array, const int N, const int D, const int INIT_SE
exit
(
1
);
}
const
int
imin
=
(
N
/
ALL_THREADS
)
*
ME
;
const
int
imax
=
(
ME
==
ALL_THREADS
-
1
)
?
N
:
(
N
/
ALL_THREADS
)
*
(
ME
+
1
);
const
int
MY_N
=
imax
-
imin
;
//
const int imin = (N / ALL_THREADS) * ME;
//
const int imax = (ME == ALL_THREADS - 1 ) ? N : (N / ALL_THREADS) * (ME+1);
//
const int MY_N = imax - imin;
errcode
=
vdRngUniform
(
VSL_RNG_METHOD_UNIFORM_STD
,
stream
,
MY_N
*
D
,
&
array
[
imin
*
D
],
LOWER_BOUND
,
UPPER_BOUND
);
errcode
=
vdRngUniform
(
VSL_RNG_METHOD_UNIFORM_STD
,
stream
,
N
*
D
,
&
array
[
0
],
LOWER_BOUND
,
UPPER_BOUND
);
if
(
errcode
!=
VSL_ERROR_OK
&&
errcode
!=
VSL_STATUS_OK
){
printf
(
"vslNewStream error. dataIo.cpp line 24.
\n
"
);
exit
(
1
);
}
}
void
random_init_8_selective
(
double
*
array
,
const
int
N
,
const
int
D
,
const
int
INIT_SEED
){
const
int
ME
=
omp_get_thread_num
();
const
int
ALL_THREADS
=
omp_get_num_threads
();
VSLStreamStatePtr
stream
;
const
int
SEED
=
(
ME
+
15
)
*
INIT_SEED
;
const
double
LOWER_BOUND
=
0.0
;
const
double
UPPER_BOUND
=
1.0
;
int
errcode
=
vslNewStream
(
&
stream
,
VSL_BRNG_MCG31
,
SEED
);
if
(
errcode
!=
VSL_ERROR_OK
&&
errcode
!=
VSL_STATUS_OK
){
printf
(
"vslNewStream error. dataIo.cpp line 9.
\n
"
);
exit
(
1
);
}
// const int imin = (N / ALL_THREADS) * ME;
// const int imax = (ME == ALL_THREADS - 1 ) ? N : (N / ALL_THREADS) * (ME+1);
// const int MY_N = imax - imin;
errcode
=
vdRngUniform
(
VSL_RNG_METHOD_UNIFORM_STD
,
stream
,
1
*
D
,
&
array
[
0
],
LOWER_BOUND
,
UPPER_BOUND
);
// first value always 0
errcode
=
vdRngUniform
(
VSL_RNG_METHOD_UNIFORM_STD
,
stream
,
N
*
D
,
&
array
[
0
],
LOWER_BOUND
,
UPPER_BOUND
);
if
(
errcode
!=
VSL_ERROR_OK
&&
errcode
!=
VSL_STATUS_OK
){
printf
(
"vslNewStream error. dataIo.cpp line 24.
\n
"
);
exit
(
1
);
}
// // test output (sanity check)
// for ( int i = 0 ; i < 3 ; i++ ){
// for ( int j=0 ; j < D ; j++ ){
// printf("%f ", array[i*D + j]);
// }
// printf("\n");
// }
// write the value of array[i*D+8] in all remaining dimensions (d>8)
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
N
;
i
++
){
double
value
=
array
[
i
*
D
+
8
];
for
(
int
j
=
8
;
j
<
D
;
j
++
){
array
[
i
*
D
+
j
]
=
value
;
}
}
}
void
random_init
(
double
*
array
,
const
int
N
,
const
int
D
){
...
...
@@ -68,6 +115,7 @@ void read_file(double *array, const int N, const int D, char filename[], const b
if
(
IS_BINARY
){
// printf("processing binary file!");fflush(stdout);
// read binary file, everything at once
// printf("binary");
counts
=
fread
(
array
,
N
*
D
,
sizeof
(
double
),
fp
);
// printf("%dx%d: %d readed\n", N, D, counts);
if
(
counts
==
0
)
{
...
...
@@ -75,6 +123,7 @@ void read_file(double *array, const int N, const int D, char filename[], const b
exit
(
1
);
}
}
else
{
printf
(
"not binary"
);
// processing a text file
// format: there are D double values each line. Each value is separated by a space character.
// notice MAX_LINE_LENGTH = 2049
...
...
@@ -104,7 +153,7 @@ void save_binary_file(double *array, const int N, const int D, char filename[]){
FILE
*
fp
=
NULL
;
size_t
counts
=
0
;
fp
=
fopen
(
filename
,
"w"
);
fp
=
fopen
(
filename
,
"w
b
"
);
if
(
fp
==
NULL
){
fprintf
(
stderr
,
"Could not open file '%s'!"
,
filename
);
...
...
util/dataIo.h
View file @
d750493a
...
...
@@ -13,6 +13,7 @@
#define MAX_LINE_LENGTH 2049
void
random_init
(
double
*
array
,
const
int
N
,
const
int
D
);
void
random_init_8_selective
(
double
*
array
,
const
int
N
,
const
int
D
,
const
int
INIT_SEED
);
void
random_init_unif
(
double
*
array
,
const
int
N
,
const
int
D
,
const
int
INIT_SEED
);
void
read_file
(
double
*
array
,
const
int
N
,
const
int
D
,
char
filename
[],
const
bool
IS_BINARY
);
void
save_binary_file
(
double
*
array
,
const
int
N
,
const
int
D
,
char
filename
[]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment