Ignore:
Timestamp:
Nov 10, 2016, 11:11:58 PM (3 years ago)
Author:
lindanl
Message:

Some fixes for editd. Add timer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/editd/EditdCudaDriver.h

    r5212 r5213  
    1616
    1717/// main - Program entry point
    18 ulong * RunPTX(std::string PTXFilename, char * fileBuffer, ulong filesize, const char * patternStr, unsigned patternLen) {
     18ulong * RunPTX(std::string PTXFilename, char * fileBuffer, ulong filesize, const char * patternStr, unsigned patternLen, int dist) {
    1919 
    2020  CUdevice    device;
     
    6868  int strides = filesize/(strideSize * 2) + 1;
    6969  int bufferSize = strides * strideSize;
    70   int outputSize = sizeof(ulong) * GROUPTHREADS * strides * 3 * GROUPBLOCKS;
     70  int outputSize = sizeof(ulong) * GROUPTHREADS * strides * (dist + 1) * GROUPBLOCKS;
    7171
    7272  checkCudaErrors(cuMemAlloc(&devBufferInput, bufferSize));
     
    9595  // std::cout << "Launching kernel\n";
    9696
     97  CUevent start;
     98  CUevent stop;
     99  float elapsedTime;
     100
     101  cuEventCreate(&start, CU_EVENT_BLOCKING_SYNC);
     102  cuEventRecord(start,0);
     103
    97104  // Kernel launch
    98105  checkCudaErrors(cuLaunchKernel(function, gridSizeX, gridSizeY, gridSizeZ,
    99106                                 blockSizeX, blockSizeY, blockSizeZ,
    100107                                 0, NULL, KernelParams, NULL));
    101   // std::cout << "kernel success.\n";
     108
     109  cuEventCreate(&stop, CU_EVENT_BLOCKING_SYNC);
     110  cuEventRecord(stop,0);
     111  cuEventSynchronize(stop);
     112
     113  cuEventElapsedTime(&elapsedTime, start, stop);
     114  printf("Elapsed time : %f ms\n" ,elapsedTime);
     115
    102116  // Retrieve device data
    103 
    104117  ulong * matchRslt = (ulong *) malloc(outputSize);
    105118  checkCudaErrors(cuMemcpyDtoH(matchRslt, devBufferOutput, outputSize));
Note: See TracChangeset for help on using the changeset viewer.