Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CUDAAccel.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: CUDAAccel.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.17 $       $Date: 2010/12/16 04:08:06 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *   Class to store and handle enumeration and initialization of 
00019  *   CUDA GPU accelerator devices.
00020  ***************************************************************************/
00021 #ifndef CUDACCEL_H
00022 #define CUDACCEL_H
00023 
00024 #include "WKFThreads.h"
00025 
00026 typedef struct {
00027   int deviceid;
00028   char name[80];
00029   int major;
00030   int minor;
00031   unsigned long membytes;
00032   int clockratekhz;
00033   int smcount;
00034   int overlap;
00035   int kernelexectimeoutenabled;
00036   int canmaphostmem;
00037   int computemode;
00038 } cudadevprops;
00039 
00041 class CUDAAccel {
00042 private:
00043   int cudaavail;   // whether or not the CUDA runtime is operable for VMD
00044   int numdevices;  // number of CUDA GPU accelerator devices available
00045   ResizeArray<cudadevprops> devprops;
00046   wkf_threadpool_t *cudapool;
00047 
00048   // functions for operating on a pool of CUDA devices
00049   void devpool_init(void);
00050   void devpool_fini(void);
00051 
00052   // convenience enum to match CUDA driver APIs
00053   enum { computeModeDefault=0, 
00054          computeModeExclusive=1,
00055          computeModeProhibited=2 } computeMode;
00056  
00057 public:
00058   CUDAAccel(void);
00059   virtual ~CUDAAccel(void);
00060 
00061   // functions for enumerating CUDA GPU accelerator devices
00062   // and their attributes
00063   void print_cuda_devices(void);
00064   int num_devices(void);
00065   int device_index(int dev);
00066   const char *device_name(int dev);
00067   int device_version_major(int dev);
00068   int device_version_minor(int dev);
00069   unsigned long device_membytes(int dev);
00070   float device_clock_ghz(int dev);
00071   int device_sm_count(int dev);
00072   int device_overlap(int dev);
00073   int device_kerneltimeoutenabled(int dev);
00074   int device_canmaphostmem(int dev);
00075   int device_computemode(int dev);
00076 
00077   // functions for operating on an open pool of CUDA devices
00078   int devpool_launch(void *fctn(void *), void *parms, int blocking);
00079   int devpool_wait(void);
00080   wkf_threadpool_t * get_cuda_devpool(void) { return cudapool; }
00081 
00082 };
00083 
00084 #endif
00085 
00086 
00087 

Generated on Sat May 26 01:47:50 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002