diff --git a/src/aparapi/com.amd.aparapi.jni/build.xml b/src/aparapi/com.amd.aparapi.jni/build.xml index 6743cac8b7be2b902fe99c0d81b012893b2e0946..7df8d34e07d6148006ad3cf1a246e681f75764d3 100644 --- a/src/aparapi/com.amd.aparapi.jni/build.xml +++ b/src/aparapi/com.amd.aparapi.jni/build.xml @@ -603,6 +603,8 @@ First consider editing the properties in build.properties <!-- !!! oren change -> add debug info, no optimizations <arg value="-O3" /> --> + <!-- !!! oren change -> add support for ISO C++ 2011 (C++0x) requires GCC 4.3 and later --> + <arg value="-std=c++0x" /> <arg value="-O0" /> <arg value="-g" /> <arg value="-fPIC" /> diff --git a/src/aparapi/com.amd.aparapi.jni/build_altera_ocl_v15.xml b/src/aparapi/com.amd.aparapi.jni/build_altera_ocl_v15.xml index 779ee17be14cec574afa7bd6f0d4b6193a9f3e20..941105fd9da22370c28291c8a7dc55453c1387e3 100644 --- a/src/aparapi/com.amd.aparapi.jni/build_altera_ocl_v15.xml +++ b/src/aparapi/com.amd.aparapi.jni/build_altera_ocl_v15.xml @@ -641,6 +641,8 @@ First consider editing the properties in build.properties <arg value="-O3" /> <arg value="-O0" /> --> + <!-- !!! oren change -> add support for ISO C++ 2011 (C++0x) requires GCC 4.3 and later --> + <arg value="-std=c++0x" /> <arg value="-O3" /> <arg value="-g" /> <arg value="-fPIC" /> diff --git a/src/aparapi/com.amd.aparapi.jni/src/cpp/runKernel/ConfigSettings.h b/src/aparapi/com.amd.aparapi.jni/src/cpp/runKernel/ConfigSettings.h index daa94a625367d32e683bed9762096a28ca4e1fe2..c002386f4839c5e218b5bda9e2e5467406bfe0e6 100644 --- a/src/aparapi/com.amd.aparapi.jni/src/cpp/runKernel/ConfigSettings.h +++ b/src/aparapi/com.amd.aparapi.jni/src/cpp/runKernel/ConfigSettings.h @@ -5,6 +5,11 @@ // configuration settings for building platform specific code // TODO: consider moving parts of this to a configuration file later on and load settings dynamically +#include <string> +#include <map> +#include <tuple> +#include <memory> + // use values from JNI config #include "com_amd_aparapi_internal_jni_KernelRunnerJNI.h" @@ -23,6 +28,97 @@ #define DEFAULT_FLOW com_amd_aparapi_internal_jni_KernelRunnerJNI_JNI_FLAG_DEFAULT_FLOW /////////////////////////// +#define FILE_EXT_LENGTH 8 + +class PlatformConfig +{ +public: + PlatformConfig(int flowSupport, const char *fileExt, char fileSep) + { + setFlowSupport(flowSupport); + setFileExtension(fileExt); + setFileSeperator(fileSep); + } + + void setFlowSupport(int flowSupport) + { + m_flowSupport = flowSupport; + } + + int getFlowSupport() + { + return m_flowSupport; + } + + void setFileExtension(const char *fileExt) + { + m_fileExt = fileExt; + } + + const char *getFileExtension() + { + return m_fileExt.c_str(); + } + + void setFileSeperator(char fileSep) + { + m_fileSep = fileSep; + } + + char getFileSeperator() + { + return m_fileSep; + } + +protected: + // data + int m_flowSupport; + //char m_fileExt[FILE_EXT_LENGTH]; + std::string m_fileExt; + char m_fileSep; +}; + +class PlatformConfigFactory +{ +public: + typedef std::shared_ptr<PlatformConfig> PlatformConfigPtr; + typedef std::pair<std::string,PlatformConfigPtr> PlatformConfigTuple; + typedef std::map<std::string,PlatformConfigTuple> PlatformConfigMap; + + static PlatformConfigFactory &getPlatformConfigFactory()//openclManager *oclMgr) + { + static PlatformConfigFactory *pcf; + if(pcf==NULL) + pcf = new PlatformConfigFactory(); + return *pcf; + } + + bool registerPlatformConfig(const char *name, PlatformConfigPtr platformConfigPtr) + { + m_platformConfigMap[name]=PlatformConfigTuple(name,platformConfigPtr); + return true; + } + +#define REGISTER_PLLATFORM_CONFIG(name,platformConfigPtr) bool name##PlatformConfig=PlatformConfigFactory::getPlatformConfigFactory().register(#name,platformConfigPtr); + + + PlatformConfigPtr findPlatformConfigByName(const char *name) + { + PlatformConfigMap::iterator itr = m_platformConfigMap.find(name); + if (itr != m_platformConfigMap.end()) + { + return itr->second.second; + } + else + return PlatformConfigPtr(); + } + + // data + PlatformConfigMap m_platformConfigMap; + + + +}; /////////////////////////// // define platform settings