SCM Repository
View of /branches/pure-cfg/src/include/Diderot/diderot.h
Parent Directory
|
Revision Log
Revision 1276 -
(download)
(as text)
(annotate)
Mon Jun 6 12:07:05 2011 UTC (10 years, 11 months ago) by jhr
File size: 3004 byte(s)
Mon Jun 6 12:07:05 2011 UTC (10 years, 11 months ago) by jhr
File size: 3004 byte(s)
Added timing support and fixed a build typo
/*! \file diderot.h * * \author John Reppy * * This is the interface to the Diderot runtime for the C target. For now, * we are targetting single-precision computations. */ /* * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu) * All rights reserved. */ #ifndef _DIDEROT_H_ #define _DIDEROT_H_ #include "Diderot/config.h" // include OpenCL headers when the target is OpenCL #if defined(DIDEROT_TARGET_CL) # ifdef HAVE_CL_CL_H # include <CL/cl.h> # elif defined(HAVE_OPENCL_CL_H) # include <OpenCL/cl.h> # else # error no cl.h # endif #endif /* gcc has a bug that breaks code that uses 8-byte vectors (e.g., vec2f_t), but clang * handles the code correctly. */ #if defined(__clang__) # define VEC2_OK #endif #ifdef NDEBUG #define STATIC_INLINE static inline #else #define STATIC_INLINE static #endif #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <math.h> #include <stdio.h> // for printing output #include "types.h" #include "strands.h" #include "options.h" /* load image data from Nrrd files */ extern Status_t Diderot_LoadImage1D (Diderot_string_t name, Diderot_image1D_t **img); extern Status_t Diderot_LoadImage2D (Diderot_string_t name, Diderot_image2D_t **img); extern Status_t Diderot_LoadImage3D (Diderot_string_t name, Diderot_image3D_t **img); /* functions to get input-parameter values */ extern Status_t Diderot_InputString (const char *, const char **, bool); extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool); extern Status_t Diderot_InputVec2 (const char *, Diderot_vec2_t *, bool); extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *, bool); extern char * loadKernel (const char * filename); //! Summary information about the CPU configuration. typedef struct { int numHWNodes; //!< \brief number of (possibly multicore) processors int numHWCores; //!< \brief total number of (possibly //! mulithreaded) cores int numHWThreads; //!< \brief total number of hardware threads int numCoresPerNode; //!< \brief number of cores per thread int numThdsPerCore; //!< \brief number of threads per core } CPUInfo_t; //! \brief function to get information about the CPU configuration bool GetNumCPUs (CPUInfo_t *info); //! get the current time in seconds double GetTime (); /********** scalar math functions **********/ STATIC_INLINE float minf (float a, float b) { return (a < b)? a : b; } STATIC_INLINE float maxf (float a, float b) { return (a < b)? b : a; } STATIC_INLINE float lerpf (float a, float b, float t) { return a + t*(b - a); } /********** vector math functions **********/ #include "inline-vec2.h" #include "inline-vec3.h" #include "inline-vec4.h" #include "inline-matrix.h" /********** other Diderot support functions **********/ #include "inline-image.h" #endif /* !_DIDEROT_H_ */
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |