Skip to content

Commit

Permalink
allowing different sketcher format than the constructor in InterfaceT…
Browse files Browse the repository at this point in the history
…est.cpp
  • Loading branch information
liuyangzhuan committed Jul 3, 2024
1 parent bf04e4b commit 28e9380
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
31 changes: 20 additions & 11 deletions EXAMPLE/InterfaceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ inline double Laplace_kernel(double *x, double *y, int d, double h) {
// return 0;
// }else{
return exp(-sqrt(dists)/(h));
// }
// }
}


Expand Down Expand Up @@ -151,16 +151,16 @@ inline double GreenFun(int m, double w, double v0, double tau)
}

inline double GreenFun_kernel(double *x, double *y, int d, double w)
{
{
double dists = dist2(x, y, d);
int self = sqrt(dists)<1e-20? 1:0;
if(self==1){
return 100.0;
}else{
double s0 = 2.0;
double tau = sqrt(pow(s0,2)* dists);
double s0 = 2.0;
double tau = sqrt(pow(s0,2)* dists);
double D1 = s0/(2.0*pi);
return GreenFun(d, w, D1, tau);
return GreenFun(d, w, D1, tau);
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ class C_QuantApp {
*val = Laplace_kernel(&_data[m * _d], &_data[n * _d], _d, _h);
if (m==n)
*val += _l;
break;
break;
case 9: //Laplacian kernel with low-rank update
*val = Laplace_kernel(&_data[m * _d], &_data[n * _d], _d, _h);
if (m==n)
Expand Down Expand Up @@ -707,7 +707,7 @@ if(tst==1){
for(int ii=0;ii<data_train.size();ii++)
dat_ptr[ii] = data_train.data()[ii];
nogeo=0;
}
}

/*****************************************************************/
/** tst=2: Test Kernels for Random point clouds */
Expand Down Expand Up @@ -846,6 +846,14 @@ if(tst==4){


set_option_from_command_line(argc, argv,option);

F2Cptr option_save;
d_c_bpack_copyoption(&option,&option_save);
if(ker ==8 || ker ==9 || ker ==10){
d_c_bpack_set_I_option(&option, "format", 1);
d_c_bpack_set_I_option(&option, "LRlevel", 100);
d_c_bpack_set_I_option(&option, "knn", 100);
}
d_c_bpack_printoption(&option,&ptree);

// construct hodlr with geometrical points
Expand Down Expand Up @@ -891,7 +899,8 @@ if(tst==4){
quant_ptr1->option=&option;

d_c_bpack_createptree(&size, groups, &Fcomm, &ptree1);
d_c_bpack_copyoption(&option,&option1);
d_c_bpack_copyoption(&option_save,&option1);
d_c_bpack_printoption(&option1,&ptree);
d_c_bpack_createstats(&stats1);

// d_c_bpack_set_I_option(&option1, "nogeo", 1); // no geometrical information
Expand Down Expand Up @@ -936,7 +945,7 @@ if(tst==4){
quant_ptr1->option=&option;

d_c_bpack_createptree(&size, groups, &Fcomm, &ptree1);
d_c_bpack_copyoption(&option,&option1);
d_c_bpack_copyoption(&option_save,&option1);
d_c_bpack_createstats(&stats1);

d_c_bpack_set_I_option(&option1, "nogeo", 1); // no geometrical information
Expand Down Expand Up @@ -997,7 +1006,7 @@ if(tst==3){
quant_ptr2->option=&option;

d_c_bpack_createptree(&size, groups, &Fcomm, &ptree2);
d_c_bpack_copyoption(&option,&option2);
d_c_bpack_copyoption(&option_save,&option2);
d_c_bpack_createstats(&stats2);

d_c_bpack_set_I_option(&option2, "nogeo", 1); // no geometrical information
Expand Down Expand Up @@ -1033,7 +1042,7 @@ if(tst==3){
quant_ptr2->_n=Npo;

d_c_bpack_createptree(&size, groups, &Fcomm, &ptree2);
d_c_bpack_copyoption(&option,&option2);
d_c_bpack_copyoption(&option_save,&option2);
d_c_bpack_createstats(&stats2);

d_c_bpack_set_I_option(&option2, "nogeo", 1); // no geometrical information
Expand Down
13 changes: 8 additions & 5 deletions example_scripts/runit_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export LD_LIBRARY_PATH=/global/cfs/cdirs/m2957/liuyangz/my_software/scalapack-2.
THREADS_PER_RANK=`expr 2 \* $OMP_NUM_THREADS`


for nmpi in 32
for nmpi in 64
do
# ######## Liza's datset MNIST 10K
# tst=1
Expand Down Expand Up @@ -105,19 +105,21 @@ do

######## Gaussian cloud
tst=2
N=16384
# N=16384
Ndim=3
ker=9 # Wajih's paper: ker=8: Laplacian ker=9: Laplacian with low-rank update ker=10: Wave equation kernel
knn=0
# h=0.2
lambda=10.
Nmin=256
Nmin=128
#tol=1e-4
# com_opt=4
checkerr=0
# batch=32
# blknum=1

for N in 16384 32768 65536 131072 262144
# for N in 16384
do
for com_opt in 6
do
# checkerr=0
Expand All @@ -134,13 +136,14 @@ do
for checkerr in 0
do
# mpirun -n 1 $EXEC $tst $N $Ndim $ker $h $lambda $Nmin $tol $com_opt $checkerr $batch | tee -a cloud_kernel.out
srun -n $nmpi -c 2 --cpu_bind=cores $EXEC --tst $tst --N $N --Ndim $Ndim --ker $ker --h $h --lambda $lambda --nmin_leaf $Nmin --tol_comp $tol --format 2 --near_para 2.01 --rankrate 2.0 --reclr_leaf $com_opt --errfillfull $checkerr --baca_batch $batch --LR_BLK_NUM $blknum --knn $knn --verbosity 1 | tee cloud_kernel_N_${N}_ker_${ker}_h_${h}_l_${lambda}_cherr_${checkerr}_bnum_${blknum}_comp_${com_opt}_tol_${tol}_mpi_${nmpi}_bsize_${batch}
srun -n $nmpi -c 2 --cpu_bind=cores $EXEC --tst $tst --N $N --Ndim $Ndim --ker $ker --h $h --lambda $lambda --nmin_leaf $Nmin --tol_comp $tol --format 2 --near_para 2.01 --rankrate 2.0 --reclr_leaf $com_opt --errfillfull $checkerr --baca_batch $batch --LR_BLK_NUM $blknum --knn $knn --verbosity 1 | tee cloud_kernel_N_${N}_ker_${ker}_h_${h}_l_${lambda}_cherr_${checkerr}_bnum_${blknum}_comp_${com_opt}_tol_${tol}_mpi_${nmpi}_bsize_${batch}_Nmin_${Nmin}_nonHsketcher
done
done
done
done
done
done
done



Expand Down

0 comments on commit 28e9380

Please sign in to comment.