Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ginkgo] Create new port #16536

Merged
merged 4 commits into from
Mar 29, 2021
Merged
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
86 changes: 86 additions & 0 deletions ports/ginkgo/cmake-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e75f7d6..63685f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,12 @@ include(cmake/hip_path.cmake)
include(cmake/autodetect_executors.cmake)
include(cmake/build_type_helpers.cmake)

+if (MSVC)
+ add_compile_options(/bigobj)
+elseif (MINGW OR CYGWIN)
+ add_compile_options("-Wa,-mbig-obj")
+endif()
+
# Ginkgo configuration options
option(GINKGO_DEVEL_TOOLS "Add development tools to the build system" OFF)
option(GINKGO_BUILD_TESTS "Generate build files for unit tests" ON)
diff --git a/cmake/GinkgoConfig.cmake.in b/cmake/GinkgoConfig.cmake.in
index 0348f95..3b8be0f 100644
--- a/cmake/GinkgoConfig.cmake.in
+++ b/cmake/GinkgoConfig.cmake.in
@@ -129,8 +129,6 @@ set(GINKGO_OPENMP_LIBRARIES @OpenMP_CXX_LIBRARIES@)
set(GINKGO_OPENMP_FLAGS "@OpenMP_CXX_FLAGS@")

# Provide useful HIP helper functions
-include(${CMAKE_CURRENT_LIST_DIR}/hip_helpers.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/windows_helpers.cmake)

# NOTE: we do not export benchmarks, examples, tests or devel tools
# so `third_party` libraries are currently unneeded.
diff --git a/cmake/install_helpers.cmake b/cmake/install_helpers.cmake
index ba7ea3f..7cc3ba8 100644
--- a/cmake/install_helpers.cmake
+++ b/cmake/install_helpers.cmake
@@ -14,16 +14,11 @@ function(ginkgo_install_library name subdir)
# dll is considered as runtime
install(TARGETS "${name}"
EXPORT Ginkgo
- LIBRARY DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
- ARCHIVE DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
- RUNTIME DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
)
else ()
# install .so and .a files
install(TARGETS "${name}"
EXPORT Ginkgo
- LIBRARY DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
- ARCHIVE DESTINATION ${GINKGO_INSTALL_LIBRARY_DIR}
)
endif ()
endfunction()
@@ -37,9 +32,8 @@ function(ginkgo_install)
DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.hpp"
)
- install(DIRECTORY "${Ginkgo_BINARY_DIR}/include/"
- DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}"
- FILES_MATCHING PATTERN "*.hpp"
+ install(FILES "${Ginkgo_BINARY_DIR}/include/ginkgo/config.hpp"
+ DESTINATION "${GINKGO_INSTALL_INCLUDE_DIR}/ginkgo"
)
if (GINKGO_HAVE_PAPI_SDE)
install(FILES "${Ginkgo_SOURCE_DIR}/third_party/papi_sde/papi_sde_interface.h"
@@ -70,8 +64,6 @@ function(ginkgo_install)
install(FILES
"${Ginkgo_BINARY_DIR}/GinkgoConfig.cmake"
"${Ginkgo_BINARY_DIR}/GinkgoConfigVersion.cmake"
- "${Ginkgo_SOURCE_DIR}/cmake/hip_helpers.cmake"
- "${Ginkgo_SOURCE_DIR}/cmake/windows_helpers.cmake"
DESTINATION "${GINKGO_INSTALL_CONFIG_DIR}"
)
install(EXPORT Ginkgo
diff --git a/cmake/windows_helpers.cmake b/cmake/windows_helpers.cmake
index 5f517a5..46d31ba 100644
--- a/cmake/windows_helpers.cmake
+++ b/cmake/windows_helpers.cmake
@@ -14,9 +14,7 @@ function(ginkgo_switch_windows_link lang from to)
endfunction()

macro(ginkgo_switch_to_windows_static lang)
- ginkgo_switch_windows_link(${lang} "MD" "MT")
endmacro()

macro(ginkgo_switch_to_windows_dynamic lang)
- ginkgo_switch_windows_link(${lang} "MT" "MD")
endmacro()
40 changes: 40 additions & 0 deletions ports/ginkgo/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ginkgo-project/ginkgo
REF v1.3.0
SHA512 40db39666730a2120d0c5e197518f784aab71655781c037fb83302a346f6bf717e5c58491e9b29b9adacb492328e11bc60960f99323c220d53505ecab6489871
HEAD_REF master
PATCHES
cmake-fixes.patch
windows-iterator.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
openmp GINKGO_BUILD_OMP
cuda GINKGO_BUILD_CUDA
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
PREFER_NINJA
OPTIONS
-DGINKGO_BUILD_REFERENCE=ON
-DGINKGO_BUILD_TESTS=OFF
-DGINKGO_BUILD_EXAMPLES=OFF
-DGINKGO_BUILD_HIP=OFF
-DGINKGO_BUILD_BENCHMARKS=OFF
-DGINKGO_DEVEL_TOOLS=OFF
-DGINKGO_SKIP_DEPENDENCY_UPDATE=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
-DGinkgo_NAME=ginkgo
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Ginkgo)
vcpkg_fixup_pkgconfig()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/ginkgo" RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
26 changes: 26 additions & 0 deletions ports/ginkgo/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "ginkgo",
"version-semver": "1.3.0",
"description": "Ginkgo is a high-performance linear algebra library for manycore systems, with a focus on sparse solution of linear systems. Note that the OpenMP feature is not available on Windows, and the CUDA feature on Windows requires the CUDACXX environment variable to point to the CUDA nvcc.exe compiler with VCPKG_KEEP_ENV_VARS set to CUDACXX to pass its value through to the vcpkg environment.",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"cuda": {
"description": "Build the CUDA backend of Ginkgo",
"dependencies": [
"cuda"
]
},
"openmp": {
"description": "Build the OpenMP backend of Ginkgo"
}
}
}
117 changes: 117 additions & 0 deletions ports/ginkgo/windows-iterator.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
diff --git a/core/base/iterator_factory.hpp b/core/base/iterator_factory.hpp
index b7efd21dfe..5e4bddeb17 100644
--- a/core/base/iterator_factory.hpp
+++ b/core/base/iterator_factory.hpp
@@ -110,7 +110,7 @@ class IteratorFactory {

~Reference() {}

- Reference(IteratorFactory &parent, array_index_type array_index)
+ Reference(IteratorFactory *parent, array_index_type array_index)
: parent_(parent), arr_index_(array_index)
{}

@@ -143,10 +143,10 @@ class IteratorFactory {
{
// In C++11, it is legal for a nested class to access private
// members of the parent class.
- parent_.dominant_values_[arr_index_] =
- std::move(other.parent_.dominant_values_[other.arr_index_]);
- parent_.secondary_values_[arr_index_] =
- std::move(other.parent_.secondary_values_[other.arr_index_]);
+ parent_->dominant_values_[arr_index_] =
+ std::move(other.parent_->dominant_values_[other.arr_index_]);
+ parent_->secondary_values_[arr_index_] =
+ std::move(other.parent_->secondary_values_[other.arr_index_]);
return *this;
}

@@ -174,25 +174,25 @@ class IteratorFactory {
return left.dominant < right.dominant();
}

- ToSortType &dominant() { return parent_.dominant_values_[arr_index_]; }
+ ToSortType &dominant() { return parent_->dominant_values_[arr_index_]; }

const ToSortType &dominant() const
{
- return parent_.dominant_values_[arr_index_];
+ return parent_->dominant_values_[arr_index_];
}

SecondaryType &secondary()
{
- return parent_.secondary_values_[arr_index_];
+ return parent_->secondary_values_[arr_index_];
}

const SecondaryType &secondary() const
{
- return parent_.secondary_values_[arr_index_];
+ return parent_->secondary_values_[arr_index_];
}

private:
- IteratorFactory &parent_;
+ IteratorFactory *parent_;
array_index_type arr_index_;
};

@@ -214,9 +214,11 @@ class IteratorFactory {
using reference = Reference;
using iterator_category = std::random_access_iterator_tag;

+ Iterator() = default;
+
~Iterator() {}

- Iterator(IteratorFactory &parent, difference_type array_index)
+ Iterator(IteratorFactory *parent, difference_type array_index)
: parent_(parent), arr_index_(array_index)
{}

@@ -298,12 +300,12 @@ class IteratorFactory {
}

// Comparable operators
- bool operator==(const Iterator &other)
+ bool operator==(const Iterator &other) const
{
return arr_index_ == other.arr_index_;
}

- bool operator!=(const Iterator &other)
+ bool operator!=(const Iterator &other) const
{
return arr_index_ != other.arr_index_;
}
@@ -329,8 +331,8 @@ class IteratorFactory {
}

private:
- IteratorFactory &parent_;
- difference_type arr_index_;
+ IteratorFactory *parent_{};
+ difference_type arr_index_{};
};

public:
@@ -363,7 +365,7 @@ class IteratorFactory {
* Creates an iterator pointing to the beginning of both arrays
* @returns an iterator pointing to the beginning of both arrays
*/
- Iterator begin() { return {*this, 0}; }
+ Iterator begin() { return {this, 0}; }

/**
* Creates an iterator pointing to the (excluding) end of both arrays
@@ -371,7 +373,7 @@ class IteratorFactory {
*/
Iterator end()
{
- return {*this, static_cast<typename Iterator::difference_type>(size_)};
+ return {this, static_cast<typename Iterator::difference_type>(size_)};
}

private:

4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,10 @@
"baseline": "5.1.4-6",
"port-version": 0
},
"ginkgo": {
"baseline": "1.3.0",
"port-version": 0
},
"gl2ps": {
"baseline": "1.4.2",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/g-/ginkgo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b204eef5f779c05c2160e28cc07f411258ddcbfc",
"version-semver": "1.3.0",
"port-version": 0
}
]
}