Go to the documentation of this file.00001 #ifndef VIENNACL_LINALG_KERNELS_SCALAR_SOURCE_HPP_
00002 #define VIENNACL_LINALG_KERNELS_SCALAR_SOURCE_HPP_
00003
00004 namespace viennacl
00005 {
00006 namespace linalg
00007 {
00008 namespace kernels
00009 {
00010 const char * const scalar_align1_inplace_sub =
00011 " \n"
00012 "__kernel void inplace_sub(\n"
00013 " __global float * val1,\n"
00014 " __global const float * val2) \n"
00015 "{ \n"
00016 " if (get_global_id(0) == 0)\n"
00017 " *val1 -= *val2;\n"
00018 "}\n"
00019 " \n"
00020 ;
00021
00022 const char * const scalar_align1_cpu_inplace_div =
00023 " \n"
00024 "__kernel void cpu_inplace_div(\n"
00025 " __global float * val1,\n"
00026 " float val2) \n"
00027 "{ \n"
00028 " if (get_global_id(0) == 0)\n"
00029 " *val1 /= val2;\n"
00030 "}\n"
00031 "\n"
00032 " \n"
00033 ;
00034
00035 const char * const scalar_align1_cpu_inplace_add =
00036 " \n"
00037 "__kernel void cpu_inplace_add(\n"
00038 " __global float * val1,\n"
00039 " float val2) \n"
00040 "{ \n"
00041 " if (get_global_id(0) == 0)\n"
00042 " *val1 += val2;\n"
00043 "}\n"
00044 " \n"
00045 ;
00046
00047 const char * const scalar_align1_cpu_sub =
00048 " \n"
00049 "__kernel void cpu_sub(\n"
00050 " __global const float * val1,\n"
00051 " float val2, \n"
00052 " __global float * result) \n"
00053 "{ \n"
00054 " if (get_global_id(0) == 0)\n"
00055 " *result = *val1 - val2;\n"
00056 "}\n"
00057 " \n"
00058 ;
00059
00060 const char * const scalar_align1_cpu_mul =
00061 " \n"
00062 "__kernel void cpu_mul(\n"
00063 " __global const float * val1,\n"
00064 " float val2, \n"
00065 " __global float * result) \n"
00066 "{ \n"
00067 " if (get_global_id(0) == 0)\n"
00068 " *result = *val1 * val2;\n"
00069 "}\n"
00070 " \n"
00071 ;
00072
00073 const char * const scalar_align1_sub =
00074 " \n"
00075 "__kernel void sub(\n"
00076 " __global const float * val1,\n"
00077 " __global const float * val2, \n"
00078 " __global float * result) \n"
00079 "{ \n"
00080 " if (get_global_id(0) == 0)\n"
00081 " *result = *val1 - *val2;\n"
00082 "}\n"
00083 " \n"
00084 ;
00085
00086 const char * const scalar_align1_inplace_mul =
00087 " \n"
00088 "__kernel void inplace_mul(\n"
00089 " __global float * val1,\n"
00090 " __global const float * val2) \n"
00091 "{ \n"
00092 " if (get_global_id(0) == 0)\n"
00093 " *val1 *= *val2;\n"
00094 "}\n"
00095 " \n"
00096 ;
00097
00098 const char * const scalar_align1_cpu_inplace_mul =
00099 " \n"
00100 "__kernel void cpu_inplace_mul(\n"
00101 " __global float * val1,\n"
00102 " float val2) \n"
00103 "{ \n"
00104 " if (get_global_id(0) == 0)\n"
00105 " *val1 *= val2;\n"
00106 "}\n"
00107 " \n"
00108 ;
00109
00110 const char * const scalar_align1_mul =
00111 " \n"
00112 "__kernel void mul(\n"
00113 " __global const float * val1,\n"
00114 " __global const float * val2, \n"
00115 " __global float * result) \n"
00116 "{ \n"
00117 " if (get_global_id(0) == 0)\n"
00118 " *result = *val1 * *val2;\n"
00119 "}\n"
00120 " \n"
00121 ;
00122
00123 const char * const scalar_align1_cpu_add =
00124 " \n"
00125 "__kernel void cpu_add(\n"
00126 " __global const float * val1,\n"
00127 " float val2, \n"
00128 " __global float * result) \n"
00129 "{ \n"
00130 " if (get_global_id(0) == 0)\n"
00131 " *result = *val1 + val2;\n"
00132 "}\n"
00133 " \n"
00134 ;
00135
00136 const char * const scalar_align1_inplace_div =
00137 " \n"
00138 "__kernel void inplace_div(\n"
00139 " __global float * val1,\n"
00140 " __global const float * val2) \n"
00141 "{ \n"
00142 " if (get_global_id(0) == 0)\n"
00143 " *val1 /= *val2;\n"
00144 "}\n"
00145 " \n"
00146 ;
00147
00148 const char * const scalar_align1_add =
00149 " \n"
00150 "__kernel void add(\n"
00151 " __global const float * val1,\n"
00152 " __global const float * val2, \n"
00153 " __global float * result) \n"
00154 "{ \n"
00155 " if (get_global_id(0) == 0)\n"
00156 " *result = *val1 + *val2;\n"
00157 "}\n"
00158 " \n"
00159 ;
00160
00161 const char * const scalar_align1_cpu_inplace_sub =
00162 " \n"
00163 "__kernel void cpu_inplace_sub(\n"
00164 " __global float * val1,\n"
00165 " float val2) \n"
00166 "{ \n"
00167 " if (get_global_id(0) == 0)\n"
00168 " *val1 -= val2;\n"
00169 "}\n"
00170 " \n"
00171 "\n"
00172 ;
00173
00174 const char * const scalar_align1_inplace_add =
00175 " \n"
00176 "__kernel void inplace_add(\n"
00177 " __global float * val1,\n"
00178 " __global const float * val2) \n"
00179 "{ \n"
00180 " if (get_global_id(0) == 0)\n"
00181 " *val1 += *val2;\n"
00182 "}\n"
00183 " \n"
00184 ;
00185
00186 const char * const scalar_align1_divide =
00187 " \n"
00188 "// note: 'div' seems to produce some name clashes with the OpenCL jit-compiler, thus using 'divide'\n"
00189 "__kernel void divide(\n"
00190 " __global const float * val1,\n"
00191 " __global const float * val2, \n"
00192 " __global float * result) \n"
00193 "{ \n"
00194 " if (get_global_id(0) == 0)\n"
00195 " *result = *val1 / *val2;\n"
00196 "}\n"
00197 "\n"
00198 " \n"
00199 ;
00200
00201 const char * const scalar_align1_cpu_div =
00202 " \n"
00203 "__kernel void cpu_div(\n"
00204 " __global const float * val1,\n"
00205 " float val2, \n"
00206 " __global float * result) \n"
00207 "{ \n"
00208 " if (get_global_id(0) == 0)\n"
00209 " *result = *val1 / val2;\n"
00210 "}\n"
00211 " \n"
00212 ;
00213
00214 }
00215 }
00216 }
00217 #endif