diff --git a/CHANGES.md b/CHANGES.md
index 104f97e..697f2df 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,10 @@
+1.1.1 November 25, 2016
+=======================
+
+- Release fixes
+- Option to choose an OpenCL device
+- Install and uninstall CMake changes
+
1.1 November, 2016
===================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e205d3..717a899 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,20 +11,21 @@ cmake_minimum_required(VERSION 3.1)
project(OgmaNeo)
set(CMAKE_VERBOSE_MAKEFILE OFF)
+
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
-#if(NOT CMAKE_BUILD_TYPE)
-# message(STATUS "CMAKE_BUILD_TYPE not set, setting it to Release")
-# set(CMAKE_BUILD_TYPE Release)
-#endif()
-#message("Build type: ${CMAKE_BUILD_TYPE}")
+if(NOT CMAKE_BUILD_TYPE)
+ message("CMAKE_BUILD_TYPE not set, setting it to Release")
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(BITNESS 64)
+ set(BITNESS 64)
else()
- set(BITNESS 32)
+ set(BITNESS 32)
endif()
-#message("Bitness: ${BITNESS}")
+message(STATUS "Bitness: ${BITNESS}")
option(BUILD_SHARED_LIBS OFF)
message(STATUS "Shared libs: ${BUILD_SHARED_LIBS}")
@@ -235,8 +236,10 @@ add_custom_target(OgmaOCLtoH ALL DEPENDS ${outFiles})
# Find list of library source code
file(GLOB_RECURSE LIBRARY_SRC
- "source/*.h"
- "source/*.cpp"
+ "source/neo/*.h"
+ "source/neo/*.cpp"
+ "source/system/*.h"
+ "source/system/*.cpp"
)
include_directories(SYSTEM "${PROJECT_SOURCE_DIR}/source")
@@ -265,9 +268,18 @@ endif()
# and OpenCL to H file generation
add_dependencies(OgmaNeo OgmaNeoSchemas OgmaOCLtoH)
target_link_libraries(OgmaNeo ${OPENCL_LIBRARIES})
+
set_property(TARGET OgmaNeo PROPERTY CXX_STANDARD 14)
set_property(TARGET OgmaNeo PROPERTY CXX_STANDARD_REQUIRED ON)
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ if(BITNESS EQUAL 32)
+ set_target_properties(OgmaNeo PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
+ else()
+ set_target_properties(OgmaNeo PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
+ endif()
+endif()
+
# Library install target
install(TARGETS OgmaNeo
RUNTIME DESTINATION bin
@@ -276,12 +288,12 @@ install(TARGETS OgmaNeo
# Headers, incl. schema headers, install targets
install(DIRECTORY "${PROJECT_SOURCE_DIR}/source/"
- DESTINATION include
+ DESTINATION include/ogmaneo
FILES_MATCHING PATTERN "*.h*")
# 3rd party headers install targets
install(DIRECTORY "${3RDPARTY_PATH}/include/"
- DESTINATION include
+ DESTINATION include/ogmaneo
FILES_MATCHING PATTERN "*.h*")
# Uninstall target
@@ -290,5 +302,5 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
-add_custom_target(UNINSTALL
+add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
diff --git a/README.md b/README.md
index d6c4df2..f676dba 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
## Introduction
-Welcome to [Ogma Intelligent Systems Corp](https://ogmacorp.com) OgmaNeo library. A C++ library that contains implementation(s) of Online Predictive Hierarchies, as described in the arXiv.org paper: [Feynman Machine: The Universal Dynamical Systems Computer](http://arxiv.org/abs/1609.03971).
+Welcome to [Ogma](https://ogmacorp.com) OgmaNeo library. A C++ library that contains implementation(s) of Online Predictive Hierarchies, as described in the arXiv.org paper: [Feynman Machine: The Universal Dynamical Systems Computer](http://arxiv.org/abs/1609.03971).
The current release of this library contains a form of Sparse Predictive Hierarchies. Refer to the arXiv.org paper for further details.
@@ -232,7 +232,7 @@ Refer to the [CONTRIBUTING.md](https://github.com/ogmacorp/OgmaNeo/blob/master/C
The work in this repository is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. See the [OGMANEO_LICENSE.md](https://github.com/ogmacorp/OgmaNeo/blob/master/OGMANEO_LICENSE.md) and [LICENSE.md](https://github.com/ogmacorp/OgmaNeo/blob/master/LICENSE.md) file for further information.
-Contact Ogma Intelligent Systems Corp licenses@ogmacorp.com to discuss commercial use and licensing options.
+Contact Ogma via licenses@ogmacorp.com to discuss commercial use and licensing options.
The OgmaNeo library uses the Google [FlatBuffers](http://google.github.io/flatbuffers/) package that is licensed with an Apache License (Version 2.0). Refer to this [LICENSE.txt](https://github.com/google/flatbuffers/blob/master/LICENSE.txt) file for the full licensing text associated with the FlatBuffers package.
diff --git a/source/neo/Architect.cpp b/source/neo/Architect.cpp
index b94e8c6..29d3e86 100644
--- a/source/neo/Architect.cpp
+++ b/source/neo/Architect.cpp
@@ -245,22 +245,22 @@ std::shared_ptr Architect::generateAgent(std::unordered_map();
- _cs->create(type);
+ _cs->create(type, index);
}
const std::shared_ptr &getComputeSystem() const {
diff --git a/source/neo/SparseFeaturesChunk.cpp b/source/neo/SparseFeaturesChunk.cpp
index cb16fe1..56ea2d3 100644
--- a/source/neo/SparseFeaturesChunk.cpp
+++ b/source/neo/SparseFeaturesChunk.cpp
@@ -181,8 +181,8 @@ void SparseFeaturesChunk::activate(ComputeSystem &cs, const std::vector(std::ceil(static_cast(_hiddenSize.x) / static_cast(_chunkSize.x)));
+ int chunksInY = static_cast(std::ceil(static_cast(_hiddenSize.y) / static_cast(_chunkSize.y)));
int argIndex = 0;
@@ -287,8 +287,8 @@ void SparseFeaturesChunk::learn(ComputeSystem &cs, std::mt19937 &rng) {
void SparseFeaturesChunk::inhibit(ComputeSystem &cs, const cl::Image2D &activations, cl::Image2D &states, std::mt19937 &rng) {
// Inhibit
{
- int chunksInX = _hiddenSize.x / _chunkSize.x + 1;
- int chunksInY = _hiddenSize.y / _chunkSize.y + 1;
+ int chunksInX = static_cast(std::ceil(static_cast(_hiddenSize.x) / static_cast(_chunkSize.x)));
+ int chunksInY = static_cast(std::ceil(static_cast(_hiddenSize.y) / static_cast(_chunkSize.y)));
int argIndex = 0;
diff --git a/source/system/ComputeSystem.cpp b/source/system/ComputeSystem.cpp
index b4712db..2fbb7e6 100644
--- a/source/system/ComputeSystem.cpp
+++ b/source/system/ComputeSystem.cpp
@@ -12,7 +12,7 @@
using namespace ogmaneo;
-bool ComputeSystem::create(DeviceType type, bool createFromGLContext) {
+bool ComputeSystem::create(DeviceType type, unsigned int index, bool createFromGLContext) {
std::vector allPlatforms;
cl::Platform::get(&allPlatforms);
@@ -47,7 +47,13 @@ bool ComputeSystem::create(DeviceType type, bool createFromGLContext) {
}
if (!allDevices.empty()) {
- _device = allDevices.front();
+ if (index >= allDevices.size()) {
+#ifdef SYS_DEBUG
+ std::cout << "Indexed device not found." << std::endl;
+#endif
+ return false;
+ }
+ _device = allDevices[index];
std::vector workItemSizes;
_device.getInfo(CL_DEVICE_MAX_WORK_ITEM_SIZES, &workItemSizes);
@@ -73,14 +79,14 @@ bool ComputeSystem::create(DeviceType type, bool createFromGLContext) {
}
}
- if (allDevices.empty()) {
+ if (allDevices.empty() || index >= allDevices.size()) {
#ifdef SYS_DEBUG
std::cout << "No devices found. Check your OpenCL installation." << std::endl;
#endif
return false;
}
- _device = allDevices.front();
+ _device = allDevices[index];
#ifdef SYS_DEBUG
std::cout << "Using device: " << _device.getInfo() << std::endl;
@@ -122,4 +128,4 @@ bool ComputeSystem::create(DeviceType type, bool createFromGLContext) {
_queue = cl::CommandQueue(_context, _device);
return true;
-}
\ No newline at end of file
+}
diff --git a/source/system/ComputeSystem.h b/source/system/ComputeSystem.h
index ac1df1c..0456dc9 100644
--- a/source/system/ComputeSystem.h
+++ b/source/system/ComputeSystem.h
@@ -53,9 +53,9 @@ namespace ogmaneo {
public:
/*!
\brief Create an OpenCL compute system with a given device type.
- Optional: Create from an OpenGL context
+ Optional: Create from a device index and an OpenGL context
*/
- bool create(DeviceType type, bool createFromGLContext = false);
+ bool create(DeviceType type, unsigned int index = 0, bool createFromGLContext = false);
/*!
\brief Get underlying OpenCL platform