123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef MANDEL_MANDEL_H
- #define MANDEL_MANDEL_H
- #include <vector>
- #include <map>
- #include <string>
- #include <memory>
- #include "MandelUtil.h"
- #include "Generators.h"
- #include "CpuGenerators.h"
- #include "Hardware.h"
- //#include "Fixedp.h"
- namespace mnd
- {
- enum class GeneratorType;
- class MandelContext;
- class MandelDevice;
- extern MandelContext initializeContext(void);
- const std::string& getGeneratorName(mnd::GeneratorType);
- GeneratorType getTypeFromName(const std::string& name);
- }
- enum class mnd::GeneratorType
- {
- FLOAT,
- FLOAT_SSE2,
- FLOAT_AVX,
- FLOAT_AVX512,
- FLOAT_NEON,
- DOUBLE,
- DOUBLE_SSE2,
- DOUBLE_AVX,
- DOUBLE_AVX512,
- DOUBLE_NEON,
- DOUBLE_DOUBLE,
- DOUBLE_DOUBLE_AVX,
- QUAD_DOUBLE,
- FLOAT128,
- FLOAT256,
- FIXED512
- };
- class mnd::MandelDevice
- {
- private:
- friend class MandelContext;
- std::string vendor;
- std::string name;
- std::map<GeneratorType, std::unique_ptr<Generator>> generators;
- MandelDevice(void);
- public:
- MandelDevice(const MandelDevice&) = delete;
- MandelDevice(MandelDevice&&) = default;
- MandelDevice& operator=(const MandelDevice&) = delete;
- MandelDevice& operator=(MandelDevice&&) = default;
- inline const std::string& getVendor(void) const { return vendor; }
- inline const std::string& getName(void) const { return name; }
- Generator* getGenerator(GeneratorType type) const;
- std::vector<GeneratorType> getSupportedTypes(void) const;
- };
- class mnd::MandelContext
- {
- private:
- friend MandelContext mnd::initializeContext(void);
- CpuInfo cpuInfo;
- std::map<GeneratorType, std::unique_ptr<Generator>> cpuGenerators;
- std::unique_ptr<AdaptiveGenerator> adaptiveGenerator;
- std::vector<MandelDevice> devices;
- MandelContext(void);
- std::unique_ptr<AdaptiveGenerator> createAdaptiveGenerator(void);
- std::vector<MandelDevice> createDevices(void);
- public:
- MandelContext(const MandelContext&) = delete;
- MandelContext(MandelContext&&) = default;
- MandelContext& operator=(const MandelContext&) = delete;
- MandelContext& operator=(MandelContext&&) = default;
- AdaptiveGenerator& getDefaultGenerator(void);
- const std::vector<MandelDevice>& getDevices(void);
- Generator* getCpuGenerator(mnd::GeneratorType type);
- std::vector<GeneratorType> getSupportedTypes(void) const;
- const CpuInfo& getCpuInfo(void) const { return cpuInfo; }
- };
- #endif // MANDEL_MANDEL_H
|