| 161 | } |
| 162 | |
| 163 | struct Parameters { |
| 164 | size_t batch_size; |
| 165 | clfftPrecision precision; |
| 166 | clfftDirection direction; |
| 167 | clfftDim dimensions; |
| 168 | std::vector<size_t> lengths; |
| 169 | std::vector<size_t> input_strides; |
| 170 | std::vector<size_t> output_strides; |
| 171 | size_t input_distance; |
| 172 | size_t output_distance; |
| 173 | clfftLayout input_layout; |
| 174 | clfftLayout output_layout; |
| 175 | clfftResultLocation placeness; |
| 176 | double forward_scale; |
| 177 | double backward_scale; |
| 178 | data_pattern pattern; |
| 179 | size_t data_seed; |
| 180 | // start scales at double. we can just cast to float at the cost of |
| 181 | // a little precision if single precision is randomly chosen. no biggie |
| 182 | |
| 183 | //we want to define a maximum stride so that memory does not get out of control |
| 184 | static const size_t max_stride = 5; |
| 185 | static const size_t max_distance = 128; |
| 186 | |
| 187 | size_t total_size_in_points() |
| 188 | { |
| 189 | if( lengths.empty() ) |
| 190 | throw std::runtime_error( "you shouldn't be here!" ); |
| 191 | |
| 192 | size_t total_size = 1; |
| 193 | for( size_t i = 0; i < lengths.size(); i++ ) |
| 194 | total_size *= lengths[i]; |
| 195 | |
| 196 | return total_size; |
| 197 | } |
| 198 | |
| 199 | bool is_in_place() |
| 200 | { |
| 201 | if( placeness == CLFFT_INPLACE ) return true; |
| 202 | else return false; |
| 203 | } |
| 204 | |
| 205 | bool is_out_of_place() |
| 206 | { |
| 207 | return !is_in_place(); |
| 208 | } |
| 209 | |
| 210 | bool is_r2c() |
| 211 | { |
| 212 | if( input_layout == CLFFT_REAL ) return true; |
| 213 | else return false; |
| 214 | } |
| 215 | |
| 216 | bool is_c2r() |
| 217 | { |
| 218 | if( output_layout == CLFFT_REAL ) return true; |
| 219 | else return false; |
| 220 | } |