Optimized Belief Propagation (CPU and GPU)
Float16Test.cpp
Go to the documentation of this file.
1 /*
2 Copyright (C) 2024 Scott Grauer-Gray
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
27 #include <iostream>
28 #include <x86intrin.h>
29 
37 int main(int argc, char** argv)
38 {
39 #define TEST_FLOAT16
40 #if defined(TEST_FLOAT16)
41  _Float16 x1{1.0f};
42  _Float16 x2{3.0f};
43  _Float16 x3{5.0f};
44  _Float16 x4{7.0f};
45 
46  _Float16 x_sum = x1 + x2 + x3 + x4;
47  std::cout << "Sum: " << (float)x_sum << std::endl;
48 
49  _Float16 x_mul = x1 * x3;
50  std::cout << "Mul: " << (float)x_mul << std::endl;
51 
52  _Float16 x_div = x4 / x3;
53  std::cout << "Div: " << (float)x_div << std::endl;
54 
55  _Float16 x_sub = x4 - x2;
56  std::cout << "Sub: " << (float)x_sub << std::endl;
57 #else
58  std::cout << "No float16 test" << std::endl;
59 #endif //TEST_FLOAT61
60 
61  return 0;
62 }
int main(int argc, char **argv)
main() function to test _Float16 data type
Definition: Float16Test.cpp:37