Loading [MathJax]/extensions/tex2jax.js
Parallel numerical verification of the σ_odd problem  October 6, 2018
All Classes Namespaces Files Functions Variables Typedefs Macros
opencl.hpp
Go to the documentation of this file.
1 /* -*- coding: latin-1 -*- */
2 /** \file opencl/opencl/opencl.hpp (February 6, 2018)
3  * \brief
4  * Implementation of the OpenCL parallel algorithms presented in the report.
5  *
6  * GPLv3 --- Copyright (C) 2017, 2018 Olivier Pirson
7  * http://www.opimedia.be/
8  */
9 
10 #ifndef PROGS_SRC_OPENCL_OPENCL_OPENCL_HPP_
11 #define PROGS_SRC_OPENCL_OPENCL_OPENCL_HPP_
12 
13 // \cond
14 #include <set>
15 #include <string>
16 #include <vector>
17 // \endcond
18 
19 #include "helper.hpp"
20 
21 
22 namespace opencl {
23 
24  /* ************
25  * Prototypes *
26  **************/
27 
28  /** \brief
29  * Check in the order all odd gentle numbers between first_n and last_n,
30  * and if print_bad
31  * then print all bad numbers between first_n and last_n (included).
32  * The consequence of the result is that:
33  * if (all numbers < first_n respect the conjecture)
34  * and (all perfect squares < last_n respect the conjecture)
35  * and (all bad numbers < last_n respect the conjecture)
36  * then all numbers < last_n respect the conjecture.
37  *
38  * If prime_time
39  * then print the calculation time computed by OpenCL.
40  *
41  * sigmaodd::primes.cpp must be compiled without the macro PRIME16.
42  *
43  * @param first_n 3 <= odd <= last_n
44  * @param last_n <= MAX_POSSIBLE_N
45  * @param opencl_nb_number number of n transmitted to OpenCL in one step
46  * @param print_bad
47  * @param print_time
48  *
49  * @return the set of all bad numbers between first_n and last_n (included)
50  */
51  std::set<nat_type>
53  unsigned int opencl_nb_number = 65536,
54  bool print_bad = true, bool print_time = true);
55 
56 
57  /** \brief
58  * Like opencl_check_gentle_varsigma_odd()
59  * but instead parallelize on group of opencl_nb numbers,
60  * compute separately for each number and parallelize the factorization.
61  *
62  * sigmaodd::primes.cpp must be compiled without the macro PRIME16.
63  *
64  * @param first_n 3 <= odd <= last_n
65  * @param last_n <= MAX_POSSIBLE_N
66  * @param opencl_nb number of OpenCL units (must be a power of 2, at least 2)
67  * @param print_bad
68  * @param print_time
69  *
70  * @return the set of all bad numbers between first_n and last_n (included)
71  */
72  std::set<nat_type>
74  unsigned int opencl_nb = 1024,
75  bool print_bad = true, bool print_time = true);
76 
77 
78  /** \brief
79  * Check all numbers in ns
80  * and return vector of all bad numbers found.
81  *
82  * @param ns vector of odds
83  */
84  std::vector<nat_type>
85  opencl_check_ns(const std::vector<nat_type> &ns);
86 
87 
88  /** \brief
89  * Run the OpenCL program from filename on ns.
90  * Used for tests.
91  */
92  std::vector<nat_type>
93  opencl_run_program_on_ns(const std::string &filename, const std::string &kernal_name,
94  const std::vector<nat_type> &ns);
95 
96 } // namespace opencl
97 
98 #endif // PROGS_SRC_OPENCL_OPENCL_OPENCL_HPP_
std::vector< nat_type > opencl_run_program_on_ns(const std::string &filename, const std::string &kernal_name, const std::vector< nat_type > &ns)
Run the OpenCL program from filename on ns. Used for tests.
Definition: opencl.cpp:516
unsigned long nat_type
Type for natural number used in all code, on 64 bits.
Definition: sigmaodd.cl:22
Helper functions for the OpenCL.
std::set< nat_type > opencl_check_gentle_varsigma_odd(nat_type first_n, nat_type last_n, unsigned int opencl_nb_number, bool print_bad, bool print_time)
Check in the order all odd gentle numbers between first_n and last_n, and if print_bad then print all...
Definition: opencl.cpp:31
std::vector< nat_type > opencl_check_ns(const std::vector< nat_type > &ns)
Check all numbers in ns and return vector of all bad numbers found.
Definition: opencl.cpp:440
std::set< nat_type > opencl_check_gentle_varsigma_odd__parallelize_factorization(nat_type first_n, nat_type last_n, unsigned int opencl_nb, bool print_bad, bool print_time)
Like opencl_check_gentle_varsigma_odd() but instead parallelize on group of opencl_nb numbers...
Definition: opencl.cpp:219