From c1d09b1ad02160850d40c0d242a0d0ec0a8dc1bc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 26 Nov 2014 22:30:33 +0200 Subject: Work in progress: Move Calc-independend OpenCL configuration out of sc Intermediate commit. More changes will follow: The device selection logic needs to be moved, too. (And cleaned up.) Instead of the separate formulacalculationoptions dialog we should simply have a normal options page for those OpenCL-related settings that will remain purely Calc-specific, like the formula opcode subsetting. Change-Id: Id60d95e80d377cbbf5780beb473b221bce06b5e5 --- include/opencl/openclconfig.hxx | 100 ++++++++++++++++++++++++++++++++++++++++ include/opencl/opencldllapi.h | 34 ++++++++++++++ include/opencl/platforminfo.hxx | 51 ++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 include/opencl/openclconfig.hxx create mode 100644 include/opencl/opencldllapi.h create mode 100644 include/opencl/platforminfo.hxx (limited to 'include') diff --git a/include/opencl/openclconfig.hxx b/include/opencl/openclconfig.hxx new file mode 100644 index 000000000000..c3a11034f1b4 --- /dev/null +++ b/include/opencl/openclconfig.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX +#define INCLUDED_OPENCL_OPENCLCONFIG_HXX + +#include +#include + +#include +#include +#include + +#include + +struct OPENCL_DLLPUBLIC OpenCLConfig +{ + struct ImplMatcher + { + OUString maOS; + OUString maOSVersion; + OUString maPlatformVendor; + OUString maDevice; + OUString maDriverVersion; + + ImplMatcher() + { + } + + ImplMatcher(const OUString& rOS, + const OUString& rOSVersion, + const OUString& rPlatformVendor, + const OUString& rDevice, + const OUString& rDriverVersion) + : maOS(rOS), + maOSVersion(rOSVersion), + maPlatformVendor(rPlatformVendor), + maDevice(rDevice), + maDriverVersion(rDriverVersion) + { + } + + bool operator==(const ImplMatcher& r) const + { + return maOS == r.maOS && + maOSVersion == r.maOSVersion && + maPlatformVendor == r.maPlatformVendor && + maDevice == r.maDevice && + maDriverVersion == r.maDriverVersion; + } + bool operator!=(const ImplMatcher& r) const + { + return !operator==(r); + } + bool operator<(const ImplMatcher& r) const + { + return (maOS < r.maOS || + (maOS == r.maOS && + (maOSVersion < r.maOSVersion || + (maOSVersion == r.maOSVersion && + (maPlatformVendor < r.maPlatformVendor || + (maPlatformVendor == r.maPlatformVendor && + (maDevice < r.maDevice || + (maDevice == r.maDevice && + (maDriverVersion < r.maDriverVersion))))))))); + } + }; + + bool mbUseOpenCL; + + typedef std::set ImplMatcherSet; + + ImplMatcherSet maBlackList; + ImplMatcherSet maWhiteList; + + OpenCLConfig(); + + bool operator== (const OpenCLConfig& r) const; + bool operator!= (const OpenCLConfig& r) const; + + static OpenCLConfig get(); + + void set(); + + bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const; +}; + +OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig); +OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl); +OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/opencl/opencldllapi.h b/include/opencl/opencldllapi.h new file mode 100644 index 000000000000..f62b94cb77fc --- /dev/null +++ b/include/opencl/opencldllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OPENCL_OPENCLDLLAPI_H +#define INCLUDED_OPENCL_OPENCLDLLAPI_H + +#include + +#if defined(OPENCL_DLLIMPLEMENTATION) +#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define OPENCL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define OPENCL_DLLPRIVATE SAL_DLLPRIVATE + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/opencl/platforminfo.hxx b/include/opencl/platforminfo.hxx new file mode 100644 index 000000000000..6c40c438ed5a --- /dev/null +++ b/include/opencl/platforminfo.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_OPENCL_PLATFORMINFO_HXX +#define INCLUDED_OPENCL_PLATFORMINFO_HXX + +#include +#include + +#include + +#include +#include + +// Struct that describs an actual instance of an OpenCL device + +struct OPENCL_DLLPUBLIC OpenCLDeviceInfo +{ + cl_device_id device; + OUString maName; + OUString maVendor; + OUString maDriver; + size_t mnMemory; + size_t mnComputeUnits; + size_t mnFrequency; + + OpenCLDeviceInfo(); +}; + +// Struct that describs an actual instance of an OpenCL platform implementation + +struct OPENCL_DLLPUBLIC OpenCLPlatformInfo +{ + cl_platform_id platform; + OUString maVendor; + OUString maName; + std::vector maDevices; + + OpenCLPlatformInfo(); +}; + +OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLPlatformInfo& rPlatform); +OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLDeviceInfo& rDevice); + +#endif -- cgit