[Pvfs2-cvs] commit by sson in pvfs2/src/server: kmeans.sm
CVS commit program
cvs at parl.clemson.edu
Mon Feb 22 16:27:02 EST 2010
Update of /projects/cvsroot/pvfs2/src/server
In directory parlweb1:/tmp/cvs-serv696/src/server
Modified Files:
Tag: as-branch
kmeans.sm
Log Message:
Added a conditional compilation check for enabling/disabling CUDA, --with-cuda=<dir>
Modified the kmeans.sm to make it compile depending on --with-cuda option.
Index: kmeans.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/Attic/kmeans.sm,v
diff -p -u -r1.1.2.19 -r1.1.2.20
--- kmeans.sm 4 Feb 2010 03:28:02 -0000 1.1.2.19
+++ kmeans.sm 22 Feb 2010 21:27:02 -0000 1.1.2.20
@@ -27,6 +27,7 @@
#include "pint-cached-config.h"
#include "trove.h"
+#ifdef BUILD_CUDA
extern void initGPU (float* objects, int numDataPoints,
int numDimensions, int numClusters);
extern void freeGPU (void);
@@ -35,6 +36,7 @@ extern void singleGPU (float* objects, i
int numClusters, int* membership,
int *newClusterSize,
float* newClusters, float *error);
+#endif
#define CONTINUE_KMEANS 301
#define ALLREDUCE2 302
@@ -305,7 +307,7 @@ static PINT_sm_action cleanup_bcast_fn(s
free(bcast_op->u.bcast.send_buf);
free(bcast_op->u.bcast.recv_buf);
free(bcast_op);
-
+#ifdef BUILD_CUDA
if(s_op->u.kmeans.use_gpu == 1) {
/* initialize GPU device and allocate memory on it */
if(device_initialized == 0) {
@@ -322,6 +324,7 @@ static PINT_sm_action cleanup_bcast_fn(s
device_initialized = 1;
}
}
+#endif
return SM_ACTION_COMPLETE;
}
@@ -336,12 +339,13 @@ static PINT_sm_action local_comp_fn(stru
if(s_op->u.kmeans.use_gpu == 1) {
gossip_debug(GOSSIP_IO_DEBUG, "%s: before calling singleGPU\n", __func__);
-
+#ifdef BUILD_CUDA
singleGPU(s_op->u.kmeans.objects[0], s_op->u.kmeans.numObjs,
s_op->u.kmeans.numCoords, s_op->u.kmeans.clusters[0],
s_op->u.kmeans.numClusters, s_op->u.kmeans.membership,
s_op->u.kmeans.newClusterSize,
s_op->u.kmeans.newClusters[0], &s_op->u.kmeans.delta);
+#endif
gossip_debug(GOSSIP_IO_DEBUG, "%s: after calling singleGPU\n", __func__);
}
@@ -646,8 +650,10 @@ static PINT_sm_action check_done_fn(stru
js_p->error_code = 0;
gossip_debug(GOSSIP_IO_DEBUG, "kmeans DONE!\n");
+#ifdef BUILD_CUDA
if(s_op->u.kmeans.use_gpu == 1)
freeGPU();
+#endif
#if DEBUG
/* print out the final result */
for (i=0; i<s_op->u.kmeans.numObjs; i++)
More information about the Pvfs2-cvs
mailing list