Skip to content

Commit 4853ce4

Browse files
committed
add casvm_fcfs and casvm_bkm
1 parent d11da0a commit 4853ce4

24 files changed

+8809
-0
lines changed

casvm_bkm/casvm_bkm.cpp

Lines changed: 1178 additions & 0 deletions
Large diffs are not rendered by default.

casvm_bkm/clean.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash -l
2+
rm casvm_bkm
3+
rm *.mdl*
4+
rm subdata*
5+
rm accuracyfile;
6+
rm alpha_out
7+
rm sv_file
8+
rm libsvm_out
9+
rm split
10+
rm counting
11+
rm testout
12+
rm subdata*
13+
rm accuracyfile
14+
rm clusterFile.kmeans

casvm_bkm/count.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include<stdio.h>
2+
int main(){
3+
int correct=0;
4+
int total=0;
5+
int i,j;
6+
FILE * accuracyfile = fopen("accuracyfile", "r");
7+
while(fscanf(accuracyfile, "%d %d", &i, &j)!=EOF){
8+
correct+=i;
9+
total+=j;
10+
}
11+
printf("\n****************************************************\n\n");
12+
printf("Total Accuracy = %g%% (%d/%d) (classification)\n", (double)correct/total*100,correct,total);
13+
printf("\n****************************************************\n");
14+
}

casvm_bkm/run.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash -l
2+
rm casvm_bkm
3+
rm *.mdl*
4+
rm subdata*
5+
rm accuracyfile;
6+
rm alpha_out
7+
rm sv_file
8+
rm libsvm_out
9+
rm split
10+
rm counting
11+
rm testout
12+
rm subdata*
13+
rm accuracyfile
14+
rm clusterFile.kmeans
15+
node=8
16+
cost=32
17+
gamma=2
18+
epsilon=1e-2
19+
tolerance=1e-1
20+
export KMP_AFFINITY='compact'
21+
echo $KMP_AFFINITY
22+
#export OMP_NUM_THREADS=24
23+
#echo $OMP_NUM_THREADS
24+
25+
#mpiicpc -o casvm_bkm -openmp -simd casvm_bkm.cpp;
26+
mpic++ -o casvm_bkm casvm_bkm.cpp;
27+
28+
mpirun -np $node ./casvm_bkm -c $cost -g $gamma -e $epsilon -t $tolerance -o ijcnn.mdl -q alpha_out -s sv_file ../dataset/ijcnn.r
29+
30+
g++ -o split split.cpp;
31+
g++ -o counting count.cpp;
32+
33+
./split ../dataset/ijcnn.t;
34+
x=0
35+
while [ $x -le $(( $node - 1 )) ]
36+
do
37+
echo "the model from $x node"
38+
../libsvm2/svm-predict ./subdata$x ijcnn.mdl$x libsvm_out;
39+
x=$(( $x + 1 ))
40+
done
41+
./counting;

0 commit comments

Comments
 (0)