Ignore:
Timestamp:
Jun 22, 2017, 1:55:52 PM (2 years ago)
Author:
lindanl
Message:

editd: number of groups is now defined by number of pattern segments.

File:
1 edited

Legend:

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

    r5514 r5528  
    66#include <unistd.h>
    77#include <cassert>
     8#include <toolchain/toolchain.h>
    89#include "cuda.h"
    910
    1011#define GROUPTHREADS 64
    11 #define GROUPBLOCKS 64
    1212
    1313void checkCudaErrors(CUresult err) {
     
    7474  CUdeviceptr devStrides;
    7575
     76  const unsigned numOfGroups = codegen::GroupNum;
    7677  int strideSize = GROUPTHREADS * sizeof(ulong) * 4;
    7778  int strides = filesize/(strideSize * 2) + 1;
    7879  int bufferSize = strides * strideSize;
    79   int outputSize = sizeof(ulong) * GROUPTHREADS * strides * (dist + 1) * GROUPBLOCKS;
     80  int outputSize = sizeof(ulong) * GROUPTHREADS * strides * (dist + 1) * numOfGroups;
    8081
    8182  checkCudaErrors(cuMemAlloc(&devBufferInput, bufferSize));
     
    9697  unsigned blockSizeY = 1;
    9798  unsigned blockSizeZ = 1;
    98   unsigned gridSizeX  = GROUPBLOCKS;
     99  unsigned gridSizeX  = numOfGroups;
    99100  unsigned gridSizeY  = 1;
    100101  unsigned gridSizeZ  = 1;
     
    134135  // Retrieve device data
    135136  ulong * matchRslt;
    136   if (posix_memalign((void**)&matchRslt, 32, outputSize/GROUPBLOCKS)) {
     137  if (posix_memalign((void**)&matchRslt, 32, outputSize/numOfGroups)) {
    137138    std::cerr << "Cannot allocate memory for output.\n";
    138139    exit(-1);
    139140  }
    140141 
    141   checkCudaErrors(cuMemcpyDtoH(matchRslt, devBufferOutput, outputSize/GROUPBLOCKS));
     142  checkCudaErrors(cuMemcpyDtoH(matchRslt, devBufferOutput, outputSize/numOfGroups));
    142143
    143144  // Clean-up
Note: See TracChangeset for help on using the changeset viewer.