예제 #1
0
 // Initialization code to find the best CUDA Device
 int findCudaDevice(int argc, const char **argv)
 {
     cudaDeviceProp deviceProp;
     int devID = 0;
     // If the command-line has a device number specified, use it
     if (checkCmdLineFlag(argc, argv, "device")) {
         devID = getCmdLineArgumentInt(argc, argv, "device=");
         if (devID < 0) {
             printf("Invalid command line parameters\n");
             exit(-1);
         } else {
             devID = gpuDeviceInit(devID);
             if (devID < 0) {
                printf("exiting...\n");
                shrQAFinishExit(argc, (const char **)argv, QA_FAILED);
                exit(-1);
             }
         }
     } else {
         // Otherwise pick the device with highest Gflops/s
         devID = gpuGetMaxGflopsDeviceId();
         checkCudaErrors( cudaSetDevice( devID ) );
         checkCudaErrors( cudaGetDeviceProperties(&deviceProp, devID) );
         printf("> Using CUDA device [%d]: %s\n", devID, deviceProp.name);
     }
     return devID;
 }
예제 #2
0
	CDataManager::CDataManager() :	m_ifDataReady(false), m_MinTime(0), m_MaxTime(0), /*m_CurTime(0), m_TimeRange(0),*/ \
		m_CurTimeData(NULL),m_TimeRangeData(NULL), m_TimeWindowData(NULL), m_TimeStepData(NULL), \
		/*m_StartIdx(0), m_EndIdx(0),*/ /*m_TimeStep(TIMESTEP),*/ /*m_RangeStep(RANGESTEP), */\
		m_RangeRatio(RANGERATIO), m_BrushType(Brush_One), m_filterType(NONE), m_CurrentTimesliderIdx(0), \
		m_ifSkip(false),m_dataUpdateStyle(UPDATE_STYLE), m_RawData(NULL), \
		m_CurrentFilter(-1),m_CurrentFilterEX(-1),m_CurrentFilterNEX(-1), \
		m_BasedFilteredData(NULL), m_ExclusiveFilter(NULL), m_NegExclusiveFilter(NULL)
	{
		gpuDeviceInit(0);
		cudaGLSetGLDevice(0);

		m_ExclusiveFilter = new CFilter();
		m_NegExclusiveFilter = new CFilter();
	
		m_RawData = new CRawData();
		m_RawData->SetDataManager(this);

		m_BasedFilteredData = new CFilteredData();
		
		m_CurTimeData = new CCurTime();
		m_TimeRangeData = new CTimeRange();
		m_TimeWindowData = new CTimeWindow();
		m_TimeStepData = new CTimeStep();
		AddRelation( m_CurTimeData, m_TimeWindowData, false);
		AddRelation( m_TimeRangeData, m_TimeWindowData, false);
		m_TimeStepData->SetTimeStep(TIMESTEP);

		//Registeration
		AddRelation( m_RawData, m_BasedFilteredData, true );
		AddRelation( m_ExclusiveFilter, m_BasedFilteredData, false );
		AddRelation( m_NegExclusiveFilter, m_BasedFilteredData, false );
		AddRelation( m_TimeWindowData, m_BasedFilteredData, false);
	}
예제 #3
0
// Initialization code to find the best CUDA Device
inline int findCudaDevice(int argc, const char **argv)
{
    cudaDeviceProp deviceProp;
    int devID = 0;

    // If the command-line has a device number specified, use it
    if (checkCmdLineFlag(argc, argv, "device"))
    {
        devID = getCmdLineArgumentInt(argc, argv, "device=");

        if (devID < 0)
        {
            printf("Invalid command line parameter\n ");
            exit(EXIT_FAILURE);
        }
        else
        {
            devID = gpuDeviceInit(devID);

            if (devID < 0)
            {
                printf("exiting...\n");
                exit(EXIT_FAILURE);
            }
        }
    }
    else
    {
        // Otherwise pick the device with highest Gflops/s
        devID = gpuGetMaxGflopsDeviceId();
        checkCudaErrors(cudaSetDevice(devID));
        checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID));
        printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor);
    }

    return devID;
}