mycuda.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 #ifndef MYCUDA_H
00026 #define MYCUDA_H
00027 
00028 #include <string.h>
00029 
00030 #if defined(__cplusplus)
00031 namespace sofa
00032 {
00033 namespace gpu
00034 {
00035 namespace cuda
00036 {
00037 #endif
00038 
00039 extern "C" {
00040 extern int mycudaInit(int device=-1);
00041 extern void mycudaMalloc(void **devPtr, size_t size);
00042 extern void mycudaMallocPitch(void **devPtr, size_t* pitch, size_t width, size_t height);
00043 extern void mycudaFree(void *devPtr);
00044 extern void mycudaMallocHost(void **hostPtr, size_t size);
00045 extern void mycudaFreeHost(void *hostPtr);
00046 //extern void mycudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind);
00047 extern void mycudaMemcpyHostToDevice(void *dst, const void *src, size_t count);
00048 extern void mycudaMemcpyDeviceToDevice(void *dst, const void *src, size_t count);
00049 extern void mycudaMemcpyDeviceToHost(void *dst, const void *src, size_t count);
00050 extern void mycudaMemcpyHostToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height);
00051 extern void mycudaMemcpyDeviceToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height);
00052 extern void mycudaMemcpyDeviceToHost2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height);
00053 
00054 extern void mycudaGLRegisterBufferObject(int id);
00055 extern void mycudaGLUnregisterBufferObject(int id);
00056 
00057 extern void mycudaGLMapBufferObject(void** ptr, int id);
00058 extern void mycudaGLUnmapBufferObject(int id);
00059 
00060 extern void mycudaLogError(int err, const char* src);
00061 extern int myprintf(const char* fmt, ...);
00062 extern const char* mygetenv(const char* name);
00063 
00064 enum MycudaVerboseLevel
00065 {
00066     LOG_NONE = 0,
00067     LOG_ERR = 1,
00068     LOG_INFO = 2,
00069     LOG_TRACE = 3
00070 };
00071 
00072 extern MycudaVerboseLevel mycudaVerboseLevel;
00073 }
00074 
00075 
00076 #if defined(__cplusplus)
00077 } // namespace cuda
00078 } // namespace gpu
00079 } // namespace sofa
00080 #endif
00081 
00082 #endif

Generated on Sun Nov 23 04:05:45 2008 for Sofa by  doxygen 1.5.7.1