Bolt  1.1
C++ template library with support for OpenCL
bolt.h
Go to the documentation of this file.
1 /***************************************************************************
2 * Copyright 2012 - 2013 Advanced Micro Devices, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 
16 ***************************************************************************/
17 
23 #pragma once
24 #if !defined( BOLT_AMP_BOLT_H )
25 #define BOLT_AMP_BOLT_H
26 
27 #if defined(__APPLE__) || defined(__MACOSX)
28 #else
29  #include <amp.h>
30 #endif
31 
32 #include <string>
33 #include <map>
34 #include "bolt/boltVersion.h"
35 #include "bolt/amp/control.h"
36 
37 #define PUSH_BACK_UNIQUE(CONTAINER, ELEMENT) \
38  if (std::find(CONTAINER.begin(), CONTAINER.end(), ELEMENT) == CONTAINER.end()) \
39  CONTAINER.push_back(ELEMENT);
40 
64 namespace bolt {
65  namespace amp {
66 
67  class control;
68 
69 
76  void getVersion( unsigned int& major, unsigned int& minor, unsigned int& patch );
77 
82  //std::string clErrorStringA( const cl_int& status );
83 
88  //std::wstring clErrorStringW( const cl_int& status );
89 
96  /*
97  inline cl_int V_OpenCL( cl_int res, const std::string& msg, size_t lineno )
98  {
99  switch( res )
100  {
101  case CL_SUCCESS:
102  break;
103  default:
104  {
105  std::string tmp;
106  tmp.append( "V_OpenCL< " );
107  tmp.append( clErrorStringA( res ) );
108  tmp.append( " >: " );
109  tmp.append( msg );
110  //std::cout << tmp << std::endl;
111  throw ::cl::Error( res, tmp.c_str( ) );
112  }
113  }
114 
115  return res;
116  }
117  #define V_OPENCL( status, message ) V_OpenCL( status, message, __LINE__ )
118  */
119 
120  //void wait(const bolt::amp::control &ctl, ::cl::Event &e) ;
121 
122 
123  };
124 };
125 
126 #if defined( _WIN32 )
127 #define ALIGNED( bound ) __declspec( align( bound ) )
128 #else
129 #define ALIGNED( bound ) __attribute__ ( (aligned( bound ) ) )
130 #endif
131 
132 #endif