예제 #1
0
int cncMain(int argc, char *argv[]) {

    // Create a new graph context
    xrtraceCtx *context = xrtrace_create();

    // TODO: Set up arguments for new graph initialization
    // Note that you should define the members of
    // this struct by editing xrtrace_defs.h.
    xrtraceArgs *args = NULL;

    context->voxels_i = 2;
    context->voxels_j = 2;
    context->voxels_k = 2;
    // frames to trace
    context->num_frames = 1;
    // how many times do we expect to communicate rays
    context->boundary_exchanges = 3;

    // Launch the graph for execution
    xrtrace_launch(args, context);

    // Exit when the graph execution completes
    CNC_SHUTDOWN_ON_FINISH(context);

    return 0;
}
예제 #2
0
int cncMain(int argc, char *argv[]) {

#if CHOLESKY_USE_FILE
    CNC_REQUIRE(argc==4,
            "Usage: ./Cholesky matrixSize tileSize fileName (found %d args)\n", argc-1);
#else
    CNC_REQUIRE(argc==3,
            "Usage: ./Cholesky matrixSize tileSize (found %d args)\n", argc-1);
#endif

    // Create a new graph context
    CholeskyCtx *context = Cholesky_create();

    // Parse matrix dim info
    int matrixCols = atoi(argv[1]);
    int tileSize = atoi(argv[2]);
    int numTiles = matrixCols / tileSize;
    CNC_REQUIRE(matrixCols % tileSize == 0,
            "Incompatible tile size %d for the matrix of size %d\n", tileSize, matrixCols);

#if CHOLESKY_USE_FILE
    CholeskyArgs *args = cncItemAlloc(sizeof(*args));
    // Matrix read from input file
    char *lastChar = args->inFile + sizeof(args->inFile) - 1;
    *lastChar = '\0';
    strncpy(args->inFile, argv[3], sizeof(args->inFile));
    CNC_REQUIRE(*lastChar == '\0',
            "Input path is longer than %lu characters.\n", sizeof(args->inFile));
#else
    CholeskyArgs *args = NULL;
#endif

    // Set graph parameters
    context->numTiles = numTiles;
    context->tileSize = tileSize;

    // Launch the graph for execution
    Cholesky_launch(args, context);

    // Exit when the graph execution completes
    CNC_SHUTDOWN_ON_FINISH(context);

    return 0;
}