cudadefs.h

Go to the documentation of this file.
00001 /*!@file CUDA/cudadefs.h CUDA/GPU definitions */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file:
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CUDA/cudadefs.h $
00035 // $Id: cudadefs.h 12962 2010-03-06 02:13:53Z irock $
00036 //
00037 
00038 #ifndef CUDADEFS_H_DEFINED
00039 #define CUDADEFS_H_DEFINED
00040 
00041 #include <math.h>
00042 
00043 // Saliency C++ Toolkit implements Pixels as a template
00044 // that takes the dimensionality as a template argument
00045 // That definition will not work in CUDA C, so we are left
00046 // with this ugliness
00047 
00048 // 24-bit multiplication is faster on G80, but we must be sure to
00049 // multiply integers only within [-8M, 8M - 1] range
00050 #define IMUL(a, b) __mul24(a, b)
00051 
00052 //! Structure to handle 3 dimensional float
00053 typedef struct
00054 {
00055   float p[3];
00056 } float3_t;
00057 
00058 //! Structure to handle 4 dimensional float
00059 typedef struct
00060 {
00061   float p[4];
00062 } float4_t;
00063 
00064 // The tile size should be the same across all CUDA functions within a particular device and run, since one function might call another
00065 #define MAX_CUDA_DEVICES 4
00066 #define CUDA_TILE_W 16
00067 #define CUDA_TILE_H 16
00068 #define CUDA_1D_TILE_W 256
00069 #define PI 3.14159265358979f
00070 
00071 //Round a / b to nearest higher integer value
00072 inline int iDivUp(int a, int b) { return (a % b != 0) ? (a / b + 1) : (a / b); }
00073 
00074 //Round a / b to nearest higher integer value in CUDA code
00075 #define IDIVUP(a, b) ((a % b != 0) ? (a / b + 1) : (a / b))
00076 
00077 // Find min/max
00078 #define MIN(a,b) ((a<b) ? a : b)
00079 #define MAX(a,b) ((a>b) ? a : b)
00080 
00081 #endif
Generated on Sun May 8 08:40:36 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3