Skip to content

Commit

Permalink
Windows Compatibility Update + Minor ForceSymPD Change (#25)
Browse files Browse the repository at this point in the history
* added matlab functions for saving PLDS controller parameters (single and concatenated/switched systems); changed behavior of ForceSymPD

* merging windows updates into mfbolus master

* built updated documentation

* bumped version to 0.6.2

Co-authored-by: mfbolus <mfbolus>
  • Loading branch information
mfbolus authored Jun 23, 2021
1 parent ada4169 commit bfe244a
Show file tree
Hide file tree
Showing 321 changed files with 5,963 additions and 2,265 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ Thumbs.db
# Specific to this project #
############################
build/
out/
cpp.sublime-workspace
.vs/
.vscode/
.cache/

# whitelist documentation
Expand Down
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

# set project name and version (MAJOR.minor.patch)
project(ldsCtrlEst VERSION 0.6.1 LANGUAGES CXX C)
project(ldsCtrlEst VERSION 0.6.2 LANGUAGES CXX C)
# some name variants I will be using:
set(CMAKE_PROJECT_NAME_CAP LDSCTRLEST)#all caps

Expand Down Expand Up @@ -52,13 +52,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS true)

# user settings:
option(LDSCTRLEST_BUILD_EXAMPLES "Build the example programs." ON)
option(LDSCTRLEST_BUILD_FIT "Whether to build the fitting accessory code." OFF)
option(LDSCTRLEST_BUILD_FIT "Whether to build the fitting accessory code." ON)
option(LDSCTRLEST_BUILD_STATIC
"Whether to statically link library against OpenBLAS \
and build a static version of the library." OFF)
and build a static version of the library." ON)
# n.b., if both LDSCTRLEST_BUILD_FIT & LDSCTRLEST_BUILD_STATIC are enabled,
# Matlab/Octave mex files will be built.

if (WIN32)
# needed to build static library
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" )
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}" )
message(STATUS "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down Expand Up @@ -97,11 +102,16 @@ endif()

# pkg-config used for libraries that were not installed with CMake config files.
# provides `pkg_check_modules`
find_package(PkgConfig REQUIRED)
find_package(PkgConfig)
find_package(Doxygen COMPONENTS dot
OPTIONAL_COMPONENTS mscgen dia)

if(LDSCTRLEST_BUILD_STATIC AND NOT APPLE)
# Use MKL on windows
if (WIN32)
include(MKL)
endif()

if(LDSCTRLEST_BUILD_STATIC AND NOT APPLE AND NOT WIN32)
#statically-linking against openblas in this case
# OpenBLAS
include(OpenBLAS)
Expand Down Expand Up @@ -203,7 +213,7 @@ if(LDSCTRLEST_BUILD_STATIC)
$<INSTALL_INTERFACE:include>)
set_target_properties(${CMAKE_PROJECT_NAME}Static PROPERTIES VERSION
${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}
OUTPUT_NAME ${CMAKE_PROJECT_NAME})
OUTPUT_NAME ${CMAKE_PROJECT_NAME}Static)
endif()

add_subdirectory(src) #add source files...
Expand Down
16 changes: 16 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"variables": [
]
}
]
}
2 changes: 1 addition & 1 deletion cmake/Modules/Armadillo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ list(APPEND PROJECT_REQUIRED_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIRS})
# have made hdf5 a required dependency
set(PROJECT_REQUIRED_CXX_FLAGS "${PROJECT_REQUIRED_CXX_FLAGS} -DARMA_USE_HDF5")

if (LDSCTRLEST_BUILD_STATIC AND NOT APPLE)
if ((LDSCTRLEST_BUILD_STATIC AND NOT APPLE) OR (WIN32))
message(STATUS "Not using armadillo wrapper.")
set(PROJECT_REQUIRED_CXX_FLAGS "${PROJECT_REQUIRED_CXX_FLAGS} -DARMA_DONT_USE_WRAPPER")
set(ARMADILLO_LIBRARIES "")
Expand Down
3 changes: 3 additions & 0 deletions cmake/Modules/HDF5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ endif()

if(HDF5_FOUND)
list(APPEND PROJECT_REQUIRED_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
if (WIN32)
set(PROJECT_REQUIRED_CXX_FLAGS "${PROJECT_REQUIRED_CXX_FLAGS} -DH5_BUILT_AS_DYNAMIC_LIB")
endif()
else()
message(FATAL_ERROR "HDF5 was not found by cmake or pkg-config.")
endif()
150 changes: 150 additions & 0 deletions cmake/Modules/MKL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# MODIFED FROM ORIGINAL IN ARMADILLO LIBRARY. ALL CREDIT TO ORIGINAL AUTHORS.
#

# - Find the MKL libraries (no includes)
# This module defines
# MKL_LIBRARIES, the libraries needed to use Intel's implementation of BLAS & LAPACK.
# MKL_FOUND, If false, do not try to use MKL.

## the link below explains why we're linking only with mkl_rt
## https://software.intel.com/en-us/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103

set(MKL_NAMES ${MKL_NAMES} mkl_rt)

# Explicitly link?
# see: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl/link-line-advisor.html
#
#set(MKL_NAMES ${MKL_NAMES} mkl_intel_ilp64_dll)
#set(MKL_NAMES ${MKL_NAMES} mkl_intel_thread_dll)
#set(MKL_NAMES ${MKL_NAMES} mkl_core_dll)
#set(MKL_NAMES ${MKL_NAMES} libiomp5md)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MKL_ARCH intel64)
else()
set(MKL_ARCH ia32)
endif()

# set(MKL_ROOT $ENV{MKLROOT} CACHE TYPE STRING)
# message(STATUS "MKL_ROOT = ${MKL_ROOT}")
#
# if(NOT MKL_ROOT)
# set(MKL_ROOT "/opt/intel/oneapi/mkl")
# message(STATUS "NOTE: Assuming MKL_ROOT = ${MKL_ROOT}")
# endif()

set(ONEAPI_ROOT $ENV{ONEAPI_ROOT})
message(STATUS "ONEAPI_ROOT = ${ONEAPI_ROOT}")

if(NOT ONEAPI_ROOT)
set(ONEAPI_ROOT "/opt/intel/oneapi")
message(STATUS "NOTE: Assuming ONEAPI_ROOT = ${ONEAPI_ROOT}")
endif()

set(MKL_ROOT "${ONEAPI_ROOT}mkl")
message(STATUS "MKL_ROOT = ${MKL_ROOT}")

foreach (MKL_NAME ${MKL_NAMES})
find_library(${MKL_NAME}_LIBRARY
NAMES ${MKL_NAME}
PATHS
${CMAKE_SYSTEM_LIBRARY_PATH}
${MKL_ROOT}/lib/${MKL_ARCH}
${MKL_ROOT}/latest/lib/${MKL_ARCH}
${MKL_ROOT}
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/opt/intel/composerxe/lib/intel64
/opt/intel/composerxe/lib/ia32
/opt/intel/composerxe/lib/mkl/lib/intel64
/opt/intel/composerxe/lib/mkl/lib/ia32
/usr/local/intel/composerxe/lib/intel64
/usr/local/intel/composerxe/lib/ia32
/usr/local/intel/composerxe/lib/mkl/lib/intel64
/usr/local/intel/composerxe/lib/mkl/lib/ia32
/opt/intel/lib
/opt/intel/lib/intel64
/opt/intel/lib/em64t
/opt/intel/lib/lib64
/opt/intel/lib/ia32
/opt/intel/mkl/lib
/opt/intel/mkl/lib/intel64
/opt/intel/mkl/lib/em64t
/opt/intel/mkl/lib/lib64
/opt/intel/mkl/lib/ia32
/opt/intel/mkl/*/lib
/opt/intel/mkl/*/lib/intel64
/opt/intel/mkl/*/lib/em64t
/opt/intel/mkl/*/lib/lib64
/opt/intel/mkl/*/lib/32
/opt/intel/*/mkl/lib
/opt/intel/*/mkl/lib/intel64
/opt/intel/*/mkl/lib/em64t
/opt/intel/*/mkl/lib/lib64
/opt/intel/*/mkl/lib/ia32
/opt/mkl/lib
/opt/mkl/lib/intel64
/opt/mkl/lib/em64t
/opt/mkl/lib/lib64
/opt/mkl/lib/ia32
/opt/mkl/*/lib
/opt/mkl/*/lib/intel64
/opt/mkl/*/lib/em64t
/opt/mkl/*/lib/lib64
/opt/mkl/*/lib/32
/usr/local/intel/lib
/usr/local/intel/lib/intel64
/usr/local/intel/lib/em64t
/usr/local/intel/lib/lib64
/usr/local/intel/lib/ia32
/usr/local/intel/mkl/lib
/usr/local/intel/mkl/lib/intel64
/usr/local/intel/mkl/lib/em64t
/usr/local/intel/mkl/lib/lib64
/usr/local/intel/mkl/lib/ia32
/usr/local/intel/mkl/*/lib
/usr/local/intel/mkl/*/lib/intel64
/usr/local/intel/mkl/*/lib/em64t
/usr/local/intel/mkl/*/lib/lib64
/usr/local/intel/mkl/*/lib/32
/usr/local/intel/*/mkl/lib
/usr/local/intel/*/mkl/lib/intel64
/usr/local/intel/*/mkl/lib/em64t
/usr/local/intel/*/mkl/lib/lib64
/usr/local/intel/*/mkl/lib/ia32
/usr/local/mkl/lib
/usr/local/mkl/lib/intel64
/usr/local/mkl/lib/em64t
/usr/local/mkl/lib/lib64
/usr/local/mkl/lib/ia32
/usr/local/mkl/*/lib
/usr/local/mkl/*/lib/intel64
/usr/local/mkl/*/lib/em64t
/usr/local/mkl/*/lib/lib64
/usr/local/mkl/*/lib/32
)

set(TMP_LIBRARY ${${MKL_NAME}_LIBRARY})

if(TMP_LIBRARY)
set(MKL_LIBRARIES ${MKL_LIBRARIES} ${TMP_LIBRARY})
endif()
endforeach()

if(MKL_LIBRARIES)
set(MKL_FOUND "YES")
else()
set(MKL_FOUND "NO")
endif()

if(MKL_FOUND)
# Add for linked libs commented above: -DMKL_ILP64
set(PROJECT_REQUIRED_CXX_FLAGS "${PROJECT_REQUIRED_CXX_FLAGS} -DARMA_USE_LAPACK -DARMA_USE_BLAS")
list(APPEND PROJECT_REQUIRED_LIBRARIES_ABSOLUTE_NAME ${MKL_LIBRARIES})
message(STATUS "Found MKL libraries: ${MKL_LIBRARIES}")
else()
message(FATAL_ERROR "Could not find MKL libraries")
endif()

6 changes: 3 additions & 3 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<title>404 Page not found | LDS C&amp;E</title>
<link rel="manifest" href="/lds-ctrl-est/manifest.json">
<link rel="icon" href="/lds-ctrl-est/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/lds-ctrl-est/book.min.44110be292c9f873dbe57bd8895d52b387519bad9a89a86ed5c3705e11d6b0d5.css" integrity="sha256-RBEL4pLJ&#43;HPb5XvYiV1Ss4dRm62aiahu1cNwXhHWsNU=">
<script defer src="/lds-ctrl-est/en.search.min.984a87477490fafea7ec7ed9296bdbe3bb2bba10f5bd70acefff95a0dd30842d.js" integrity="sha256-mEqHR3SQ&#43;v6n7H7ZKWvb47sruhD1vXCs7/&#43;VoN0whC0="></script>
<link rel="stylesheet" href="/lds-ctrl-est/book.min.1f18e1770470f1550b743441539a68f3687608045f0f23eebeb7810c1ac57077.css" integrity="sha256-HxjhdwRw8VULdDRBU5po82h2CARfDyPuvreBDBrFcHc=" crossorigin="anonymous">
<script defer src="/lds-ctrl-est/flexsearch.min.js"></script>
<script defer src="/lds-ctrl-est/en.search.min.80cd14d7c8667f450e8f403ef9a5edfd9496696a1fb6e75c14942a43f310854e.js" integrity="sha256-gM0U18hmf0UOj0A&#43;&#43;aXt/ZSWaWoftudcFJQqQ/MQhU4=" crossorigin="anonymous"></script>
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->



<style>
Expand Down
27 changes: 17 additions & 10 deletions docs/acknowledgements/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
<meta name="generator" content="Hugo 0.80.0" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Acknowledgements # Development and publication of this library was supported in part by the NIH/NINDS Collaborative Research in Computational Neuroscience (CRCNS)/BRAIN Grant 5R01NS115327-02.">
Expand All @@ -14,16 +12,15 @@
<title>Acknowledgements | LDS C&amp;E</title>
<link rel="manifest" href="/lds-ctrl-est/manifest.json">
<link rel="icon" href="/lds-ctrl-est/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/lds-ctrl-est/book.min.44110be292c9f873dbe57bd8895d52b387519bad9a89a86ed5c3705e11d6b0d5.css" integrity="sha256-RBEL4pLJ&#43;HPb5XvYiV1Ss4dRm62aiahu1cNwXhHWsNU=">
<script defer src="/lds-ctrl-est/en.search.min.984a87477490fafea7ec7ed9296bdbe3bb2bba10f5bd70acefff95a0dd30842d.js" integrity="sha256-mEqHR3SQ&#43;v6n7H7ZKWvb47sruhD1vXCs7/&#43;VoN0whC0="></script>
<link rel="stylesheet" href="/lds-ctrl-est/book.min.1f18e1770470f1550b743441539a68f3687608045f0f23eebeb7810c1ac57077.css" integrity="sha256-HxjhdwRw8VULdDRBU5po82h2CARfDyPuvreBDBrFcHc=" crossorigin="anonymous">
<script defer src="/lds-ctrl-est/flexsearch.min.js"></script>
<script defer src="/lds-ctrl-est/en.search.min.80cd14d7c8667f450e8f403ef9a5edfd9496696a1fb6e75c14942a43f310854e.js" integrity="sha256-gM0U18hmf0UOj0A&#43;&#43;aXt/ZSWaWoftudcFJQqQ/MQhU4=" crossorigin="anonymous"></script>
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->


</head>

<body dir="ltr">
<input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" />
Expand All @@ -33,7 +30,7 @@

<nav>
<h2 class="book-brand">
<a href="/lds-ctrl-est"><img src="/lds-ctrl-est/ldsctrlest-logo.png" alt="Logo" /><span>LDS C&amp;E</span>
<a href="/lds-ctrl-est/"><img src="/lds-ctrl-est/ldsctrlest-logo.png" alt="Logo" /><span>LDS C&amp;E</span>
</a>
</h2>

Expand Down Expand Up @@ -64,7 +61,12 @@ <h2 class="book-brand">
</ul>
<p><br /></p>
<ul>
<li><a href="/lds-ctrl-est/docs/getting-started/"><strong>Getting Started</strong></a></li>
<li><a href="/lds-ctrl-est/docs/getting-started/getting-started/"><strong>Getting Started</strong></a>
<ul>
<li><a href="/lds-ctrl-est/docs/getting-started/linux-macos/">Linux/MacOS</a></li>
<li><a href="/lds-ctrl-est/docs/getting-started/windows/">Windows</a></li>
</ul>
</li>
</ul>
<p><br /></p>
<ul>
Expand Down Expand Up @@ -124,7 +126,7 @@ <h2 class="book-brand">



<script>(function(){var menu=document.querySelector("aside.book-menu nav");addEventListener("beforeunload",function(event){localStorage.setItem("menu.scrollTop",menu.scrollTop);});menu.scrollTop=localStorage.getItem("menu.scrollTop");})();</script>
<script>(function(){var menu=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(event){localStorage.setItem("menu.scrollTop",menu.scrollTop);});menu.scrollTop=localStorage.getItem("menu.scrollTop");})();</script>



Expand Down Expand Up @@ -187,6 +189,12 @@ <h2 class="book-brand">

</div>



<script>(function(){function select(element){const selection=window.getSelection();const range=document.createRange();range.selectNodeContents(element);selection.removeAllRanges();selection.addRange(range);}
document.querySelectorAll("pre code").forEach(code=>{code.addEventListener("click",function(event){select(code.parentElement);if(navigator.clipboard){navigator.clipboard.writeText(code.parentElement.textContent);}});});})();</script>




</footer>
Expand Down Expand Up @@ -218,7 +226,6 @@ <h2 class="book-brand">


</body>

</html>


Expand Down
Loading

0 comments on commit bfe244a

Please sign in to comment.