Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ option(GPRAT_ENABLE_FORMAT_TARGETS "Enable clang-format / cmake-format targets"
${PROJECT_IS_TOP_LEVEL})

if(GPRAT_ENABLE_FORMAT_TARGETS)
set(CMAKE_FORMAT_EXCLUDE "^external_ports/")

find_package(format QUIET)
if(NOT format_FOUND)
include(FetchContent)
Expand Down
19 changes: 17 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@
"deprecated": true
}
},
{
"name": "vcpkg",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON"
}
},
{
"name": "vcpkg-win64-static",
"hidden": true,
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md-release"
}
},
{
"name": "cppcheck",
"hidden": true,
Expand Down Expand Up @@ -67,7 +82,7 @@
"description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc",
"CMAKE_CXX_FLAGS": "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc /D_CRT_SECURE_NO_WARNINGS",
"CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf",
"CMAKE_SHARED_LINKER_FLAGS": "/machine:x64 /guard:cf"
}
Expand Down Expand Up @@ -146,7 +161,7 @@
},
{
"name": "ci-windows",
"inherits": ["ci-build", "ci-win64", "ci-multi-config"]
"inherits": ["ci-build", "ci-win64", "ci-multi-config", "vcpkg", "vcpkg-win64-static"]
},
{
"name": "ci-ubuntu-24.04",
Expand Down
7 changes: 2 additions & 5 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,13 @@ if(GPRAT_ENABLE_MKL)
# Link Intel oneMKL
target_link_libraries(gprat_core PUBLIC MKL::mkl_intel_lp64 MKL::mkl_core
MKL::MKL MKL::mkl_sequential)
target_compile_definitions(gprat_core PUBLIC GPRAT_ENABLE_MKL)
else()
# Link OpenBLAS
target_link_libraries(gprat_core PUBLIC ${OpenBLAS_LIB})
endif()

if(GPRAT_ENABLE_MKL)
target_compile_definitions(gprat_core PUBLIC GPRAT_ENABLE_MKL)
endif()

target_compile_features(gprat_core PUBLIC cxx_std_17)
target_compile_features(gprat_core PUBLIC cxx_std_20)

set_property(TARGET gprat_core PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand Down
1 change: 1 addition & 0 deletions core/src/cpu/gp_algorithms.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "cpu/gp_algorithms.hpp"

#include <cmath>
#include <iterator>

namespace cpu
{
Expand Down
3 changes: 2 additions & 1 deletion core/src/cpu/gp_optimizer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "cpu/gp_optimizer.hpp"

#include "cpu/adapter_cblas_fp64.hpp"
#include <numbers>
#include <numeric>

namespace cpu
Expand Down Expand Up @@ -212,7 +213,7 @@ double add_losses(const std::vector<double> &losses, std::size_t N, std::size_t
l += losses[i];
}

l += Nn * log(2.0 * M_PI);
l += Nn * log(2.0 * std::numbers::pi);
return 0.5 * l / Nn; // why /Nn?
}

Expand Down
1 change: 1 addition & 0 deletions core/src/gp_hyperparameters.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "gp_hyperparameters.hpp"

#include <iomanip>
#include <sstream>

namespace gprat_hyper
{
Expand Down
3 changes: 3 additions & 0 deletions external_ports/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# What is this?

This contains custom vcpkg ports and forks of official ones.
53 changes: 53 additions & 0 deletions external_ports/intel-mkl/copy-from-dmg.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
find_program(HDIUTIL NAMES hdiutil REQUIRED)
set(dmg_path "NOTFOUND" CACHE FILEPATH "Where to find the DMG")
set(output_dir "output_dir" CACHE FILEPATH "Where to put the packages")

if(NOT EXISTS "${dmg_path}")
message(FATAL_ERROR "'dmg_path' (${dmg_path}) does not exist.")
endif()
if(NOT IS_DIRECTORY "${output_dir}")
message(FATAL_ERROR "'output_dir' (${output_dir}) is not a directory.")
endif()

execute_process(
COMMAND mktemp -d
RESULT_VARIABLE mktemp_result
OUTPUT_VARIABLE mount_point
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT mktemp_result STREQUAL "0")
message(FATAL_ERROR "mktemp -d failed: ${mktemp_result}")
elseif(NOT IS_DIRECTORY "${mount_point}")
message(FATAL_ERROR "'mount_point' (${mount_point}) is not a directory.")
endif()

execute_process(
COMMAND "${HDIUTIL}" attach "${dmg_path}" -mountpoint "${mount_point}" -readonly
RESULT_VARIABLE mount_result
)
if(mount_result STREQUAL "0")
set(dmg_packages_dir "${mount_point}/bootstrapper.app/Contents/Resources/packages")
file(GLOB packages
"${dmg_packages_dir}/intel.oneapi.mac.mkl.devel,*"
"${dmg_packages_dir}/intel.oneapi.mac.mkl.runtime,*"
"${dmg_packages_dir}/intel.oneapi.mac.mkl.product,*"
"${dmg_packages_dir}/intel.oneapi.mac.openmp,*"
)
# Using execute_process to avoid direct errors
execute_process(
COMMAND cp -R ${packages} "${output_dir}/"
RESULT_VARIABLE copy_result
)
endif()
execute_process(
COMMAND "${HDIUTIL}" detach "${mount_point}"
RESULT_VARIABLE unmount_result
)

if(NOT mount_result STREQUAL "0")
message(FATAL_ERROR "Mounting ${dmg_path} failed: ${mount_result}")
elseif(NOT copy_result STREQUAL "0")
message(FATAL_ERROR "Coyping packages failed: ${copy_result}")
elseif(NOT unmount_result STREQUAL "0")
message(FATAL_ERROR "Unounting ${dmg_path} failed: ${unmount_result}")
endif()
Loading