LAMA
/home/brandes/workspace/LAMA/src/lama/cuda/CUDAContextManager.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_CUDA_CONTEXT_MANAGER_HPP_
00034 #define LAMA_CUDA_CONTEXT_MANAGER_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // base classes
00040 #include <lama/ContextManager.hpp>
00041 
00042 // others
00043 #include <lama/Context.hpp>
00044 
00045 #include <lama/cuda/CUDAContext.hpp>
00046 
00047 // boost
00048 #include <boost/weak_ptr.hpp>
00049 
00050 #include <string>
00051 
00052 namespace lama
00053 {
00054 
00055 class CUDAContext;
00056 
00059 #define LAMA_MAX_CUDA_DEVICES 4
00060 
00061 class LAMA_DLL_IMPORTEXPORT CUDAContextManager : public ContextManager
00062 {
00063 public:
00064 
00065     ContextPtr getContext( int deviceNr )
00066     {
00067         return getInstance( deviceNr );
00068     }
00069 
00070     ~CUDAContextManager();
00071 
00074     static ContextPtr getInstance( int deviceNr );
00075 
00076 private:
00077 
00080     CUDAContextManager();
00081 
00087     static boost::weak_ptr<CUDAContext> mCUDAContext [LAMA_MAX_CUDA_DEVICES];
00088 
00089     static CUDAContextManager theInstance; 
00090 };
00091 
00092 }
00093 
00094 #endif // LAMA_CUDA_CONTEXT_MANAGER_HPP_