We searched around trying to find any reasonable comparison of Scidb performance to existing systems (specifically, we’re looking at doing straightforward bulk-parallel operations like logistic regression/k-means). So far, we’ve found the performance is very poor — an order of magnitude or 2 worse then single machine runs or systems like Spark.
Any ideas what we’re doing wrong? The code is below. We’re running this across 4 machines with 32GB of memory each. The example code is just trying to do the regression on 100000 samples with 10 dimensions.
The insert(multiply(X, W))
query itself seems to take several seconds. What’s going on here? On a single machine, this operation is less then a millisecond; even accounting for disk reads/network issues I’d expect this to be a hundred times faster then it is.
Trying to run with more data causes the system to run out of memory.
#!/bin/bash
function create_randoms(){
x=$(($1 - 1))
y=$(($2 - 1))
echo "Creating random array $3[$1, $2]..."
iquery -anq "store(build([x=0:$x,$CHUNK_SIZE,0,
y=0:$y,$CHUNK_SIZE,0], double(1)/(random() % 10 + 1)), $3)" >/dev/null
}
function create_zeros(){
x=$(($1 - 1))
y=$(($2 - 1))
echo "Creating zero array $3[$1, $2]..."
iquery -anq "store(build([x=0:$x,$CHUNK_SIZE,0,y=0:$y,$CHUNK_SIZE,0],0),$3)" >/dev/null
}
function create_template(){
x=$(($1 - 1))
iquery -nq "create array Template [x=0:$x,$CHUNK_SIZE,0]" >/dev/null
}
function exe(){
iquery -o csv+ -q "$1"
}
function exe_silent(){
iquery -nq "$1" >/dev/null
}
function clean(){
exe_silent "drop array W"
exe_silent "drop array X"
exe_silent "drop array Y"
exe_silent "drop array Pred"
exe_silent "drop array Diff"
exe_silent "drop array Grad"
exe_silent "drop array Temp"
exe_silent "drop array Template"
}
function init(){
create_randoms $N $D X
create_randoms $N 1 Y
create_randoms $D 1 W
create_zeros $N 1 Pred
create_zeros $D 1 Grad
create_zeros $N 1 Diff
create_template $N
}
D=10 #Dimensions.
N=100000 #Points.
CHUNK_SIZE=10000
clean
init #Create arrays.
for i in {1..5}
do
iquery <<HERE
set no fetch;
set lang afl;
insert(multiply(X, W), Pred);
set lang aql;
update Pred set val= double(1)/(double(1) + exp(-val));
select Pred.val - Y.val into Diff from Pred, Y;
select sum(new_val) as val into Temp from (select X.val * R.val as
new_val from X join reshape(Diff, Template) as R on X.x = R.x) group
by y;
select val into Grad from reshape(substitute(Temp, build(Temp, 0)), Grad);
set fetch;
select W.val + 0.001 * Grad.val into W from W, Grad;
HERE
done
clean