 #include "gpugas.h"
 
 
-struct BFSBase
+//nvcc doesn't like the __device__ variable to be a static member inside BFS
+//so these are both outside.
+int g_iterationCount;
+__device__ __constant__ int g_iterationCountGPU;
+
+
+struct BFS
 {
   struct VertexData
   {

  //run on host
  {
    //initialize vertex data
    std::vector<BFSHost::VertexData> vertexData(nVertices);
    for( int i = 0; i < nVertices; ++i )
      vertexData[i].depth = -1; 

    GASEngineRef<BFSHost> engine;
    engine.setGraph(nVertices, &vertexData[0], srcs.size(), 0, &srcs[0], &dsts[0]);
    engine.setActive(sourceVertex, sourceVertex+1);
    g_iterationCount = 0;

  //run on gpu
  {
    //initialize vertex data
    std::vector<BFS::VertexData> vertexData(nVertices);
    for( int i = 0; i < nVertices; ++i )
      vertexData[i].depth = -1; 

    GASEngineGPU<BFS> engine;
    engine.setGraph(nVertices, &vertexData[0], srcs.size(), 0, &srcs[0], &dsts[0]);
    engine.setActive(sourceVertex, sourceVertex+1);
    int iter = 0;
