  * @brief Simple test driver program for computing Pagerank.
  */
 
-#include <stdio.h> 
+#include <stdio.h>
 #include <string>
 #include <deque>
 #include <vector>

using namespace gunrock::app::topk;

/******************************************************************************
 * Defines, constants, globals 
 ******************************************************************************/
bool g_verbose;
bool g_undirected;

  typename Value,
  typename SizeT,
  bool INSTRUMENT>
void RunTests(
  const Csr<VertexId, Value, SizeT> &graph,
  const Csr<VertexId, Value, SizeT> &graph_inv,
  CommandLineArgs                   &args,
  int                               max_grid_size,
  int                               num_gpus,
  int                               top_nodes,
  CudaContext                       &context)
{

  // define the problem data structure for graph primitive
  typedef TOPKProblem<VertexId, SizeT, Value> Problem;

  // INSTRUMENT specifies whether we want to keep such statistical data
  // Allocate TopK enactor map
  TOPKEnactor<INSTRUMENT> topk_enactor(g_verbose);

  // allocate problem on GPU
  // create a pointer of the TOPKProblem type
  Problem *topk_problem = new Problem;

  // reset top_nodes if input k > total number of nodes
  if (top_nodes > graph.nodes)
  {
    top_nodes = graph.nodes;
  }

  // malloc host memory
  VertexId *h_node_id   = (VertexId*)malloc(sizeof(VertexId) * top_nodes);
  VertexId *ref_node_id = (VertexId*)malloc(sizeof(VertexId) * top_nodes);
  Value    *h_degrees   = (Value*)malloc(sizeof(Value) * top_nodes);
  Value    *ref_degrees = (Value*)malloc(sizeof(Value) * top_nodes);

  // copy data from CPU to GPU
  // initialize data members in DataSlice for graph
  util::GRError(topk_problem->Init(
    g_stream_from_host,
    graph,
    graph_inv,
    num_gpus),
    "Problem TOPK Initialization Failed", __FILE__, __LINE__);

  // perform degree centrality
  GpuTimer gpu_timer; // Record the kernel running time

  // reset values in DataSlice for graph
  util::GRError(topk_problem->Reset(
    topk_enactor.GetFrontierType()),
    "TOPK Problem Data Reset Failed", __FILE__, __LINE__);

  gpu_timer.Start();
  // launch topk enactor
  util::GRError(topk_enactor.template Enact<Problem>(
    topk_problem,
    top_nodes,
    max_grid_size),
    "TOPK Problem Enact Failed", __FILE__, __LINE__);

  gpu_timer.Stop();

  float elapsed_gpu = gpu_timer.ElapsedMillis();
  printf("==> GPU TopK Degree Centrality finished in %lf msec.\n", elapsed_gpu);

  // copy out results back to CPU from GPU using Extract
  util::GRError(topk_problem->Extract(
    h_node_id,
    h_degrees,
    top_nodes),
    "TOPK Problem Data Extraction Failed",
    __FILE__, __LINE__);

  // display solution
  DisplaySolution(h_node_id, h_degrees, top_nodes);

  // validation
  SimpleReferenceTopK(graph, graph_inv, ref_node_id, ref_degrees, top_nodes);

  int error_num = CompareResults(h_node_id, ref_node_id, top_nodes, true);
  if (error_num > 0)
  {
    printf("INCOREECT! %d error(s) occured. \n", error_num);
  }
  printf("\n");

  // cleanup if neccessary
  if (topk_problem) { delete topk_problem; }
  if (h_node_id)    { free(h_node_id); }
  if (h_degrees)    { free(h_degrees); }

  cudaDeviceSynchronize();
}
