1
0

Mandel.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef MANDEL_MANDEL_H
  2. #define MANDEL_MANDEL_H
  3. #include <vector>
  4. #include <map>
  5. #include <string>
  6. #include <memory>
  7. #include "MandelUtil.h"
  8. #include "Generators.h"
  9. #include "IterationGenerator.h"
  10. #include "CpuGenerators.h"
  11. #include "Hardware.h"
  12. //#include "Fixedp.h"
  13. namespace mnd
  14. {
  15. enum class GeneratorType;
  16. class MandelContext;
  17. class MandelDevice;
  18. extern MandelContext initializeContext(void);
  19. const std::string& getGeneratorName(mnd::GeneratorType);
  20. GeneratorType getTypeFromName(const std::string& name);
  21. }
  22. enum class mnd::GeneratorType
  23. {
  24. FLOAT,
  25. FLOAT_SSE2,
  26. FLOAT_AVX,
  27. FLOAT_AVX_FMA,
  28. FLOAT_AVX512,
  29. FLOAT_NEON,
  30. DOUBLE_FLOAT,
  31. DOUBLE,
  32. DOUBLE_SSE2,
  33. DOUBLE_AVX,
  34. DOUBLE_AVX_FMA,
  35. DOUBLE_AVX512,
  36. DOUBLE_NEON,
  37. DOUBLE_DOUBLE,
  38. DOUBLE_DOUBLE_AVX,
  39. DOUBLE_DOUBLE_AVX_FMA,
  40. QUAD_DOUBLE,
  41. FLOAT128,
  42. FLOAT256,
  43. FIXED64,
  44. FIXED128,
  45. FIXED512
  46. };
  47. class mnd::MandelDevice
  48. {
  49. private:
  50. friend class MandelContext;
  51. std::string vendor;
  52. std::string name;
  53. std::map<GeneratorType, std::unique_ptr<MandelGenerator>> mandelGenerators;
  54. MandelDevice(void);
  55. public:
  56. MandelDevice(const MandelDevice&) = delete;
  57. MandelDevice(MandelDevice&&) = default;
  58. MandelDevice& operator=(const MandelDevice&) = delete;
  59. MandelDevice& operator=(MandelDevice&&) = default;
  60. inline const std::string& getVendor(void) const { return vendor; }
  61. inline const std::string& getName(void) const { return name; }
  62. MandelGenerator* getGenerator(GeneratorType type) const;
  63. std::vector<GeneratorType> getSupportedTypes(void) const;
  64. };
  65. class mnd::MandelContext
  66. {
  67. private:
  68. friend MandelContext mnd::initializeContext(void);
  69. CpuInfo cpuInfo;
  70. std::map<GeneratorType, std::unique_ptr<MandelGenerator>> cpuGenerators;
  71. std::unique_ptr<AdaptiveGenerator> adaptiveGenerator;
  72. std::unique_ptr<JuliaGenerator> juliaGenerator;
  73. std::vector<MandelDevice> devices;
  74. MandelContext(void);
  75. std::unique_ptr<AdaptiveGenerator> createAdaptiveGenerator(void);
  76. std::vector<MandelDevice> createDevices(void);
  77. public:
  78. MandelContext(const MandelContext&) = delete;
  79. MandelContext(MandelContext&&) = default;
  80. MandelContext& operator=(const MandelContext&) = delete;
  81. MandelContext& operator=(MandelContext&&) = default;
  82. AdaptiveGenerator& getDefaultGenerator(void);
  83. const std::vector<MandelDevice>& getDevices(void);
  84. MandelGenerator* getCpuGenerator(mnd::GeneratorType type);
  85. std::vector<GeneratorType> getSupportedTypes(void) const;
  86. const CpuInfo& getCpuInfo(void) const { return cpuInfo; }
  87. JuliaGenerator& getJuliaGenerator(void);
  88. };
  89. #endif // MANDEL_MANDEL_H