#ifndef MANDEL_MANDEL_H #define MANDEL_MANDEL_H // don't expose this library interface as it clashes with qt //#include namespace asmjit { class JitRuntime; } #ifndef WITH_ASMJIT // if no asmjit, use dummy implementation namespace asmjit { class JitRuntime{}; } #endif // WITH_ASMJITH #include #include #include #include #include "MandelUtil.h" #include "Generators.h" #include "IterationGenerator.h" #include "CpuGenerators.h" #include "Hardware.h" #include "CalcPlugin.h" namespace mnd { class MandelContext; class MandelDevice; struct ClDeviceWrapper; extern MandelContext initializeContext(void); struct MandelContextCache; } class mnd::MandelDevice { private: friend class MandelContext; std::string platformName; std::string vendor; std::string name; std::string extensions; std::unique_ptr clDevice; std::map> mandelGenerators; public: MandelDevice(ClDeviceWrapper, const std::string& platformName); 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; } MandelGenerator* getGenerator(Precision type) const; inline ClDeviceWrapper& getClDevice(void) { return *clDevice; } inline const ClDeviceWrapper& getClDevice(void) const { return *clDevice; } std::vector getSupportedTypes(void) const; bool supportsDouble(void) const; }; class mnd::MandelContext { private: friend MandelContext mnd::initializeContext(void); using GeneratorType = std::pair; CpuInfo cpuInfo; std::unique_ptr jitRuntime; /// /// \brief list of standard mandel generators implemented in c++ /// /// This is an owning list of Generators that can be used regardless of /// Cpu type as they are implemented in standard c++ and are integrated /// into libmandel. /// std::vector> defaultGenerators; std::vector> loadedPlugins; /// /// \brief all cpu generators currently available /// std::map cpuGenerators; std::unique_ptr adaptiveGenerator; std::vector> devices; MandelContext(void); std::unique_ptr createAdaptiveGenerator(void); std::vector> createDevices(void); public: ~MandelContext(void); MandelContext(const MandelContext&) = delete; MandelContext(MandelContext&&) = default; MandelContext& operator=(const MandelContext&) = delete; MandelContext& operator=(MandelContext&&) = default; void loadPlugin(std::unique_ptr cp); AdaptiveGenerator& getDefaultGenerator(void); std::vector>& getDevices(void); asmjit::JitRuntime& getJitRuntime(void); MandelGenerator* getCpuGenerator(mnd::Precision type, mnd::HardwareFeature ex); std::vector getSupportedTypes(void) const; std::vector getCpuGenerators(mnd::Precision prec) const; const CpuInfo& getCpuInfo(void) const { return cpuInfo; } void saveCache(const std::string& path) const; static MandelContext initializeFromCache(const std::string& path); }; struct mnd::MandelContextCache { }; #endif // MANDEL_MANDEL_H