Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/include/Diderot/diderot.h
ViewVC logotype

Annotation of /branches/pure-cfg/src/include/Diderot/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1271 - (view) (download) (as text)

1 : jhr 438 /*! \file diderot.h
2 :     *
3 :     * \author John Reppy
4 : jhr 441 *
5 :     * This is the interface to the Diderot runtime for the C target. For now,
6 :     * we are targetting single-precision computations.
7 : jhr 438 */
8 :    
9 :     /*
10 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
11 :     * All rights reserved.
12 :     */
13 :    
14 :     #ifndef _DIDEROT_H_
15 :     #define _DIDEROT_H_
16 :    
17 : jhr 1196 #include "Diderot/config.h"
18 :    
19 : jhr 601 /* gcc has a bug that breaks code that uses 8-byte vectors (e.g., vec2f_t), but clang
20 :     * handles the code correctly.
21 :     */
22 :     #if defined(__clang__)
23 :     # define VEC2_OK
24 :     #endif
25 :    
26 : jhr 579 #ifdef NDEBUG
27 : jhr 1268 #define STATIC_INLINE static inline
28 : jhr 579 #else
29 : jhr 1268 #define STATIC_INLINE static
30 : jhr 579 #endif
31 : jhr 440
32 : jhr 438 #include <stdint.h>
33 :     #include <stdbool.h>
34 : jhr 558 #include <stdlib.h>
35 :     #include <math.h>
36 : jhr 654 #include <stdio.h> // for printing output
37 : jhr 438
38 : jhr 710 #include "types.h"
39 :     #include "strands.h"
40 : jhr 1237 #include "options.h"
41 : jhr 438
42 :     /* load image data from Nrrd files */
43 : jhr 561 extern Status_t Diderot_LoadImage1D (Diderot_string_t name, Diderot_image1D_t **img);
44 :     extern Status_t Diderot_LoadImage2D (Diderot_string_t name, Diderot_image2D_t **img);
45 :     extern Status_t Diderot_LoadImage3D (Diderot_string_t name, Diderot_image3D_t **img);
46 : jhr 438
47 : jhr 439 /* functions to get input-parameter values */
48 : jhr 438 extern Status_t Diderot_InputString (const char *, const char **, bool);
49 : jhr 1229 extern Status_t Diderot_InputReal (const char *, Diderot_real_t *, bool);
50 : jhr 1231 extern Status_t Diderot_InputVec2 (const char *, Diderot_vec2_t *, bool);
51 : jhr 1229 extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *, bool);
52 : jhr 438
53 : lamonts 1271 extern char * loadKernel (const char * filename);
54 :    
55 : jhr 1268 //! Summary information about the CPU configuration.
56 : jhr 1196 typedef struct {
57 : jhr 1268 int numHWNodes; //!< \brief number of (possibly multicore) processors
58 :     int numHWCores; //!< \brief total number of (possibly
59 :     //! mulithreaded) cores
60 :     int numHWThreads; //!< \brief total number of hardware threads
61 :     int numCoresPerNode; //!< \brief number of cores per thread
62 :     int numThdsPerCore; //!< \brief number of threads per core
63 : jhr 1196 } CPUInfo_t;
64 :    
65 : jhr 1268 //! \brief function to get information about the CPU configuration
66 : jhr 1196 bool GetNumCPUs (CPUInfo_t *info);
67 :    
68 :    
69 : jhr 561 /********** scalar math functions **********/
70 :    
71 : glk 758 STATIC_INLINE float minf (float a, float b)
72 :     {
73 :     return (a < b)? a : b;
74 :     }
75 :    
76 : jhr 561 STATIC_INLINE float maxf (float a, float b)
77 :     {
78 :     return (a < b)? b : a;
79 :     }
80 :    
81 : jhr 756 STATIC_INLINE float lerpf (float a, float b, float t)
82 :     {
83 :     return a + t*(b - a);
84 :     }
85 :    
86 : jhr 710 /********** vector math functions **********/
87 : jhr 588
88 : jhr 710 #include "inline-vec2.h"
89 :     #include "inline-vec3.h"
90 :     #include "inline-vec4.h"
91 : jhr 727 #include "inline-matrix.h"
92 : jhr 588
93 :    
94 : jhr 560 /********** other Diderot support functions **********/
95 :    
96 : jhr 710 #include "inline-image.h"
97 : jhr 449
98 : jhr 438 #endif /* !_DIDEROT_H_ */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0