Example #1
0
int main(int argc, char* argv[])
{
    printOsInfo();
    printCudaInfo();

    perf::Regression::Init("nv_perf_test");
    perf::TestBase::Init(argc, argv);
    testing::InitGoogleTest(&argc, argv);

    return RUN_ALL_TESTS();
}
Example #2
0
int main(int argc, char** argv)
{

    int N = 20 * 1000 * 1000;

    // parse commandline options ////////////////////////////////////////////
    int opt;
    static struct option long_options[] = {
        {"arraysize",  1, 0, 'n'},
        {"help",       0, 0, '?'},
        {0 ,0, 0, 0}
    };

    while ((opt = getopt_long(argc, argv, "?n:", long_options, NULL)) != EOF) {

        switch (opt) {
        case 'n':
            N = atoi(optarg);
            break;
        case '?':
        default:
            usage(argv[0]);
            return 1;
        }
    }
    // end parsing of commandline options //////////////////////////////////////

    const float alpha = 2.0f;
    float* xarray = new float[N];
    float* yarray = new float[N];
    float* resultarray = new float[N];

    // load X, Y, store result
    int totalBytes = sizeof(float) * 3 * N;

    for (int i=0; i<N; i++) {
        xarray[i] = yarray[i] = i % 10;
        resultarray[i] = 0.f;
   }

    printCudaInfo();

    for (int i=0; i<3; i++) {
      saxpyCuda(N, alpha, xarray, yarray, resultarray);
    }

    delete [] xarray;
    delete [] yarray;
    delete [] resultarray;

    return 0;
}
Example #3
0
int main(int argc, char** argv)
{
    if (argc != 3 && argc != 2) {
        printf("Usage:\n");
        printf("./%s input1 input2\n", argv[0]);
        printf("./%s input_file\n", argv[0]);
        exit(0);
    }

    std::string input, body;

    printCudaInfo();

    // Reading inputs from command line
    if (argc == 3) {
        input = std::string(argv[1]);
        body = std::string(argv[2]);
    }
    else {
        char* path = argv[1];
        std::ifstream file; file.open(path);

        if (!file.is_open()) {
            printf("Invalid file path: %s\n", path);
            exit(0);
        }

        int n1, n2;

        file >> n1 >> input >> n2 >> body;

        file.close();
    }

    // Input must be shorter than body.
    if (input.length() > body.length()) {
        std::string tmp = input;
        input = body;
        body = tmp;
    }

    unsigned int min_idx, min_distance;
    edit_distance_cuda(body.c_str(), body.length(),
        input.c_str(), input.length(), min_idx, min_distance);
}