highspy-extras 1.15.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. highspy_extras-1.15.0/CMakeLists.txt +24 -0
  2. highspy_extras-1.15.0/PKG-INFO +90 -0
  3. highspy_extras-1.15.0/README.md +69 -0
  4. highspy_extras-1.15.0/THIRD_PARTY_NOTICES.md +78 -0
  5. highspy_extras-1.15.0/Version.txt +4 -0
  6. highspy_extras-1.15.0/build_backend.py +60 -0
  7. highspy_extras-1.15.0/cmake/CheckAtomic.cmake +74 -0
  8. highspy_extras-1.15.0/cmake/FindCUDAConf.cmake +44 -0
  9. highspy_extras-1.15.0/cmake/FindHipoDeps.cmake +403 -0
  10. highspy_extras-1.15.0/cmake/README.md +242 -0
  11. highspy_extras-1.15.0/cmake/cpp-highs.cmake +244 -0
  12. highspy_extras-1.15.0/cmake/dotnet.cmake +96 -0
  13. highspy_extras-1.15.0/cmake/highs-config.cmake.in +22 -0
  14. highspy_extras-1.15.0/cmake/set-version.cmake +26 -0
  15. highspy_extras-1.15.0/cmake/sources.cmake +637 -0
  16. highspy_extras-1.15.0/cmake/vcpkg.cmake +136 -0
  17. highspy_extras-1.15.0/extern/CMakeLists.txt +116 -0
  18. highspy_extras-1.15.0/extern/HighsExtrasApi.cpp +91 -0
  19. highspy_extras-1.15.0/extern/HighsExtrasApi.h +80 -0
  20. highspy_extras-1.15.0/extern/HighsExtrasApiBinding.h +127 -0
  21. highspy_extras-1.15.0/extern/HighsExtrasExternalDeps.cpp +36 -0
  22. highspy_extras-1.15.0/extern/HighsExtrasExternalDeps.h +225 -0
  23. highspy_extras-1.15.0/extern/OrderingPrint.h +10 -0
  24. highspy_extras-1.15.0/extern/README.md +197 -0
  25. highspy_extras-1.15.0/extern/amd/License.txt +35 -0
  26. highspy_extras-1.15.0/extern/amd/SuiteSparse_config.c +54 -0
  27. highspy_extras-1.15.0/extern/amd/SuiteSparse_config.h +56 -0
  28. highspy_extras-1.15.0/extern/amd/amd.h +357 -0
  29. highspy_extras-1.15.0/extern/amd/amd_1.c +172 -0
  30. highspy_extras-1.15.0/extern/amd/amd_2.c +1761 -0
  31. highspy_extras-1.15.0/extern/amd/amd_aat.c +179 -0
  32. highspy_extras-1.15.0/extern/amd/amd_control.c +70 -0
  33. highspy_extras-1.15.0/extern/amd/amd_defaults.c +37 -0
  34. highspy_extras-1.15.0/extern/amd/amd_info.c +125 -0
  35. highspy_extras-1.15.0/extern/amd/amd_internal.h +137 -0
  36. highspy_extras-1.15.0/extern/amd/amd_order.c +195 -0
  37. highspy_extras-1.15.0/extern/amd/amd_post_tree.c +105 -0
  38. highspy_extras-1.15.0/extern/amd/amd_postorder.c +140 -0
  39. highspy_extras-1.15.0/extern/amd/amd_preprocess.c +107 -0
  40. highspy_extras-1.15.0/extern/amd/amd_valid.c +93 -0
  41. highspy_extras-1.15.0/extern/amd/changes.txt +8 -0
  42. highspy_extras-1.15.0/extern/blas/myblas.cpp +7 -0
  43. highspy_extras-1.15.0/extern/blas/mycblas.h +90 -0
  44. highspy_extras-1.15.0/extern/catch/LICENCE_1_0.txt +23 -0
  45. highspy_extras-1.15.0/extern/catch/catch.hpp +18861 -0
  46. highspy_extras-1.15.0/extern/cli11/CLI11.hpp +11546 -0
  47. highspy_extras-1.15.0/extern/metis/Changes.txt +31 -0
  48. highspy_extras-1.15.0/extern/metis/GKlib/GKlib.h +62 -0
  49. highspy_extras-1.15.0/extern/metis/GKlib/error.c +21 -0
  50. highspy_extras-1.15.0/extern/metis/GKlib/gk_arch.h +64 -0
  51. highspy_extras-1.15.0/extern/metis/GKlib/gk_defs.h +19 -0
  52. highspy_extras-1.15.0/extern/metis/GKlib/gk_macros.h +54 -0
  53. highspy_extras-1.15.0/extern/metis/GKlib/gk_mangle.h +27 -0
  54. highspy_extras-1.15.0/extern/metis/GKlib/gk_mkblas.h +51 -0
  55. highspy_extras-1.15.0/extern/metis/GKlib/gk_mkmemory.h +80 -0
  56. highspy_extras-1.15.0/extern/metis/GKlib/gk_mkpqueue.h +329 -0
  57. highspy_extras-1.15.0/extern/metis/GKlib/gk_mkrandom.h +89 -0
  58. highspy_extras-1.15.0/extern/metis/GKlib/gk_mksort.h +271 -0
  59. highspy_extras-1.15.0/extern/metis/GKlib/gk_ms_inttypes.h +41 -0
  60. highspy_extras-1.15.0/extern/metis/GKlib/gk_ms_stat.h +22 -0
  61. highspy_extras-1.15.0/extern/metis/GKlib/gk_ms_stdint.h +41 -0
  62. highspy_extras-1.15.0/extern/metis/GKlib/gk_proto.h +52 -0
  63. highspy_extras-1.15.0/extern/metis/GKlib/gk_struct.h +66 -0
  64. highspy_extras-1.15.0/extern/metis/GKlib/gk_types.h +15 -0
  65. highspy_extras-1.15.0/extern/metis/GKlib/mcore.c +176 -0
  66. highspy_extras-1.15.0/extern/metis/GKlib/memory.c +23 -0
  67. highspy_extras-1.15.0/extern/metis/GKlib/random.c +37 -0
  68. highspy_extras-1.15.0/extern/metis/LICENSE.txt +18 -0
  69. highspy_extras-1.15.0/extern/metis/libmetis/auxapi.c +27 -0
  70. highspy_extras-1.15.0/extern/metis/libmetis/balance.c +491 -0
  71. highspy_extras-1.15.0/extern/metis/libmetis/bucketsort.c +44 -0
  72. highspy_extras-1.15.0/extern/metis/libmetis/coarsen.c +895 -0
  73. highspy_extras-1.15.0/extern/metis/libmetis/compress.c +231 -0
  74. highspy_extras-1.15.0/extern/metis/libmetis/contig.c +83 -0
  75. highspy_extras-1.15.0/extern/metis/libmetis/defs.h +39 -0
  76. highspy_extras-1.15.0/extern/metis/libmetis/fm.c +527 -0
  77. highspy_extras-1.15.0/extern/metis/libmetis/gklib.c +55 -0
  78. highspy_extras-1.15.0/extern/metis/libmetis/gklib_defs.h +35 -0
  79. highspy_extras-1.15.0/extern/metis/libmetis/graph.c +268 -0
  80. highspy_extras-1.15.0/extern/metis/libmetis/initpart.c +385 -0
  81. highspy_extras-1.15.0/extern/metis/libmetis/macros.h +59 -0
  82. highspy_extras-1.15.0/extern/metis/libmetis/mcutil.c +162 -0
  83. highspy_extras-1.15.0/extern/metis/libmetis/metis_mangle.h +164 -0
  84. highspy_extras-1.15.0/extern/metis/libmetis/metislib.h +37 -0
  85. highspy_extras-1.15.0/extern/metis/libmetis/mmd.c +598 -0
  86. highspy_extras-1.15.0/extern/metis/libmetis/ometis.c +661 -0
  87. highspy_extras-1.15.0/extern/metis/libmetis/options.c +260 -0
  88. highspy_extras-1.15.0/extern/metis/libmetis/proto.h +177 -0
  89. highspy_extras-1.15.0/extern/metis/libmetis/refine.c +99 -0
  90. highspy_extras-1.15.0/extern/metis/libmetis/separator.c +57 -0
  91. highspy_extras-1.15.0/extern/metis/libmetis/sfm.c +581 -0
  92. highspy_extras-1.15.0/extern/metis/libmetis/srefine.c +152 -0
  93. highspy_extras-1.15.0/extern/metis/libmetis/stdheaders.h +29 -0
  94. highspy_extras-1.15.0/extern/metis/libmetis/struct.h +117 -0
  95. highspy_extras-1.15.0/extern/metis/libmetis/util.c +59 -0
  96. highspy_extras-1.15.0/extern/metis/libmetis/wspace.c +91 -0
  97. highspy_extras-1.15.0/extern/metis/metis.h +256 -0
  98. highspy_extras-1.15.0/extern/pdqsort/license.txt +16 -0
  99. highspy_extras-1.15.0/extern/pdqsort/pdqsort.h +532 -0
  100. highspy_extras-1.15.0/extern/rcm/LICENSE +19 -0
  101. highspy_extras-1.15.0/extern/rcm/rcm.cpp +880 -0
  102. highspy_extras-1.15.0/extern/rcm/rcm.h +32 -0
  103. highspy_extras-1.15.0/extern/vcpkg.json +17 -0
  104. highspy_extras-1.15.0/extern/zstr/LICENSE +21 -0
  105. highspy_extras-1.15.0/extern/zstr/strict_fstream.hpp +237 -0
  106. highspy_extras-1.15.0/extern/zstr/zstr.hpp +473 -0
  107. highspy_extras-1.15.0/highs/HConfig.h.in +22 -0
  108. highspy_extras-1.15.0/highspy_extras/__init__.py +135 -0
  109. highspy_extras-1.15.0/pyproject.toml +100 -0
  110. highspy_extras-1.15.0/tests/test_highspy_extras.py +41 -0
@@ -0,0 +1,24 @@
1
+ # CMakeLists.txt for highspy-extras wheel
2
+ # The wheel only wraps the standalone highs_extras shared library.
3
+ # Use the dedicated extras-library mode so the top-level build adds the
4
+ # highs_extras target and installs it into the highspy-extras package.
5
+
6
+ cmake_minimum_required(VERSION 3.15...3.27)
7
+
8
+ # Resolve parent repo from either current dir (sdist) or parent (standard build)
9
+ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/extern/CMakeLists.txt")
10
+ set(_PARENT_DIR "${CMAKE_CURRENT_LIST_DIR}")
11
+ else()
12
+ set(_PARENT_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
13
+ endif()
14
+
15
+ list(APPEND CMAKE_MODULE_PATH "${_PARENT_DIR}/cmake")
16
+ include(vcpkg)
17
+ project(highs_extras LANGUAGES C CXX)
18
+
19
+ add_subdirectory("${_PARENT_DIR}/extern" "${CMAKE_CURRENT_BINARY_DIR}/extern")
20
+
21
+ install(TARGETS highs_extras
22
+ RUNTIME DESTINATION highspy_extras
23
+ LIBRARY DESTINATION highspy_extras
24
+ )
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: highspy-extras
3
+ Version: 1.15.0
4
+ Summary: HiGHS external dependencies extension for highspy
5
+ Author-Email: HiGHS developers <highsopt@gmail.com>
6
+ License-Expression: Apache-2.0 AND BSD-3-Clause
7
+ License-File: THIRD_PARTY_NOTICES.md
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Project-URL: Source Code, https://github.com/ERGO-Code/HiGHS
16
+ Project-URL: Bug Tracker, https://github.com/ERGO-Code/HiGHS/issues
17
+ Requires-Python: >=3.9
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest; extra == "test"
20
+ Description-Content-Type: text/markdown
21
+
22
+ # highspy-extras
23
+
24
+ Extension package for [highspy](https://pypi.org/project/highspy/) that enables access to external dependencies with licensing terms different from HiGHS, such as Apache 2.0.
25
+
26
+ The HiPO Interior Point Method (IPM) solver currently uses these external dependencies to provide enhanced performance for linear and quadratic programming problems. Other algorithms may also rely on `highspy-extras` in the future.
27
+
28
+ ## Installation
29
+
30
+ Install directly:
31
+
32
+ ```bash
33
+ pip install highspy-extras
34
+ ```
35
+
36
+ Or install via the highspy optional dependency:
37
+
38
+ ```bash
39
+ pip install highspy[extras]
40
+ ```
41
+
42
+ At present, the optional dependency installs support needed for HiPO.
43
+
44
+ ## Usage
45
+
46
+ When `highspy-extras` is installed, HiGHS can use algorithms that depend on these external libraries. Note that `highspy-extras` is automatically consumed by `highspy` and does not need to be imported manually. At present this primarily means the HiPO solver. You can explicitly select HiPO:
47
+
48
+ ```python
49
+ import highspy
50
+
51
+ # Create a HiGHS instance
52
+ h = highspy.Highs()
53
+
54
+ # Load your model
55
+ h.readModel("model.mps")
56
+
57
+ # Set solver to use HiPO
58
+ h.setOptionValue("solver", "hipo")
59
+
60
+ # Solve
61
+ h.run()
62
+ ```
63
+
64
+ For debugging library packaging issues, you can also query the ABI version reported directly by the shared library:
65
+
66
+ ```python
67
+ import highspy_extras
68
+
69
+ print(highspy_extras.__version__)
70
+ print(highspy_extras.get_library_version())
71
+ ```
72
+
73
+ ## Requirements
74
+
75
+ - Python >= 3.9
76
+
77
+ - BLAS library
78
+ The highspy-extras wheels on PyPI and conda-forge ship with a bundled OpenBLAS.
79
+
80
+ When installing locally from source, the requirement is:
81
+ - OpenBLAS on Windows and Linux:
82
+ - Install with vcpkg
83
+ - Install with apt on Linux
84
+ - Set BUILD_OPENBLAS=ON in cmake, to fetch and build OpenBLAS as a subproject
85
+ - Apple Accelerate on MacOS:
86
+ - MacOS comes with the Accelerate framework pre-installed
87
+
88
+ ## License
89
+
90
+ Apache 2.0 - see the license and `THIRD_PARTY_NOTICES` in the [HiGHS repository](https://github.com/ERGO-Code/HiGHS) for details.
@@ -0,0 +1,69 @@
1
+ # highspy-extras
2
+
3
+ Extension package for [highspy](https://pypi.org/project/highspy/) that enables access to external dependencies with licensing terms different from HiGHS, such as Apache 2.0.
4
+
5
+ The HiPO Interior Point Method (IPM) solver currently uses these external dependencies to provide enhanced performance for linear and quadratic programming problems. Other algorithms may also rely on `highspy-extras` in the future.
6
+
7
+ ## Installation
8
+
9
+ Install directly:
10
+
11
+ ```bash
12
+ pip install highspy-extras
13
+ ```
14
+
15
+ Or install via the highspy optional dependency:
16
+
17
+ ```bash
18
+ pip install highspy[extras]
19
+ ```
20
+
21
+ At present, the optional dependency installs support needed for HiPO.
22
+
23
+ ## Usage
24
+
25
+ When `highspy-extras` is installed, HiGHS can use algorithms that depend on these external libraries. Note that `highspy-extras` is automatically consumed by `highspy` and does not need to be imported manually. At present this primarily means the HiPO solver. You can explicitly select HiPO:
26
+
27
+ ```python
28
+ import highspy
29
+
30
+ # Create a HiGHS instance
31
+ h = highspy.Highs()
32
+
33
+ # Load your model
34
+ h.readModel("model.mps")
35
+
36
+ # Set solver to use HiPO
37
+ h.setOptionValue("solver", "hipo")
38
+
39
+ # Solve
40
+ h.run()
41
+ ```
42
+
43
+ For debugging library packaging issues, you can also query the ABI version reported directly by the shared library:
44
+
45
+ ```python
46
+ import highspy_extras
47
+
48
+ print(highspy_extras.__version__)
49
+ print(highspy_extras.get_library_version())
50
+ ```
51
+
52
+ ## Requirements
53
+
54
+ - Python >= 3.9
55
+
56
+ - BLAS library
57
+ The highspy-extras wheels on PyPI and conda-forge ship with a bundled OpenBLAS.
58
+
59
+ When installing locally from source, the requirement is:
60
+ - OpenBLAS on Windows and Linux:
61
+ - Install with vcpkg
62
+ - Install with apt on Linux
63
+ - Set BUILD_OPENBLAS=ON in cmake, to fetch and build OpenBLAS as a subproject
64
+ - Apple Accelerate on MacOS:
65
+ - MacOS comes with the Accelerate framework pre-installed
66
+
67
+ ## License
68
+
69
+ Apache 2.0 - see the license and `THIRD_PARTY_NOTICES` in the [HiGHS repository](https://github.com/ERGO-Code/HiGHS) for details.
@@ -0,0 +1,78 @@
1
+ # Third Party Licenses and Acknowledgements
2
+
3
+ The majority of the HiGHS source code is available under the [MIT license](https://opensource.org/license/MIT).
4
+
5
+ Code in the `/extern` directory was originally developed by third-parties and is
6
+ licensed under additional licenses.
7
+
8
+ ## amd
9
+
10
+ The source code in `/extern/amd` is distributed under the [BSD-3 license](https://opensource.org/license/bsd-3-clause)
11
+ at `/extern/amd/License.txt`.
12
+
13
+ It was originally developed by Timothy Davis.
14
+
15
+ The upstream source code is available at:
16
+
17
+ * https://github.com/DrTimothyAldenDavis/SuiteSparse
18
+
19
+ To avoid compiling this code into HiGHS, use `-DHIPO=OFF` (the default value).
20
+
21
+ ## cli
22
+
23
+ The source code in `/extern/CLI11.hpp` is distributed under a license stated in the source code. Although the license is not named, the text appears to correspond to the [BSD-3 license](https://opensource.org/license/bsd-3-clause).
24
+
25
+ The upstream source code is available at:
26
+
27
+ * https://github.com/CLIUtils/CLI11
28
+
29
+ CLI11 is only used to parse command line input for the HiGHS executable, so does not affect the license status of the HiGHS library or language interfaces to it.
30
+
31
+ ## metis
32
+
33
+ The source code in `/extern/metis` is distributed under the [Apache 2.0 license](https://opensource.org/license/apache-2-0)
34
+ at `/extern/metis/LICENSE.txt`.
35
+
36
+ It was originally developed by George Karypis.
37
+
38
+ The upstream source code is available at:
39
+
40
+ * https://github.com/KarypisLab/METIS
41
+ * https://github.com/KarypisLab/GKlib
42
+
43
+ To avoid compiling this code into HiGHS, use `-DHIPO=OFF` (the default value).
44
+
45
+ ## pdqsort
46
+
47
+ The source code in `/extern/pdqsort` is distributed under the [zlib license](https://opensource.org/license/zlib)
48
+ at `/extern/pdqsort/license.txt`.
49
+
50
+ It was originally developed by Orson Peters.
51
+
52
+ The upstream source code is available at:
53
+
54
+ * https://github.com/orlp/pdqsort
55
+
56
+ ## rcm
57
+
58
+ The source code in `/extern/rcm` is distributed under the [MIT license](https://opensource.org/license/MIT)
59
+ at `/extern/rcm/LICENSE`.
60
+
61
+ It was originally developed by Alan George, Joseph Liu, and John Burkardt.
62
+
63
+ The upstream source code is available at:
64
+
65
+ * https://people.sc.fsu.edu/~jburkardt/cpp_src/rcm/rcm.html
66
+
67
+ To avoid compiling this code into HiGHS, use `-DHIPO=OFF` (the default value).
68
+
69
+ ## zstr
70
+
71
+ The source code in `/extern/zstr` is distributed under the [MIT license](https://opensource.org/license/MIT)
72
+ at `/extern/zstr/LICENSE`.
73
+
74
+ It was originally developed by Matei David.
75
+
76
+ The upstream source code is available at:
77
+
78
+ * https://github.com/mateidavid/zstr
@@ -0,0 +1,4 @@
1
+ HIGHS_MAJOR=1
2
+ HIGHS_MINOR=15
3
+ HIGHS_PATCH=0
4
+ #PRE_RELEASE=YES
@@ -0,0 +1,60 @@
1
+ """Thin wrapper around scikit-build-core that stages parent-repo files
2
+ into the project tree before building the sdist."""
3
+
4
+ import shutil
5
+ from pathlib import Path
6
+
7
+ try:
8
+ import tomllib
9
+ except ModuleNotFoundError:
10
+ import tomli as tomllib
11
+
12
+ from scikit_build_core import build as _orig
13
+
14
+ _HERE = Path(__file__).resolve().parent
15
+ _PARENT = _HERE.parent
16
+
17
+
18
+ def _get_sdist_include():
19
+ with open(_HERE / "pyproject.toml", "rb") as f:
20
+ cfg = tomllib.load(f)
21
+ return cfg.get("tool", {}).get("scikit-build", {}).get("sdist", {}).get("include", [])
22
+
23
+
24
+ def build_sdist(sdist_directory, config_settings=None):
25
+ created = []
26
+ try:
27
+ for name in _get_sdist_include():
28
+ dst, src = _HERE / name, _PARENT / name
29
+ print(f"Staging {src} -> {dst}")
30
+ if dst.exists() or not src.exists():
31
+ continue
32
+
33
+ # Track any new parent dirs so they can be cleaned up
34
+ new_dirs = []
35
+ for parent in reversed(dst.relative_to(_HERE).parents[:-1]):
36
+ d = _HERE / parent
37
+ if d.exists():
38
+ break
39
+ new_dirs.append(d)
40
+
41
+ if new_dirs:
42
+ new_dirs[0].mkdir(parents=True)
43
+ created.extend(reversed(new_dirs))
44
+
45
+ (shutil.copytree if src.is_dir() else shutil.copy2)(src, dst)
46
+ created.append(dst)
47
+ return _orig.build_sdist(sdist_directory, config_settings)
48
+ finally:
49
+ for p in reversed(created):
50
+ shutil.rmtree(p) if p.is_dir() else p.unlink(missing_ok=True)
51
+
52
+
53
+ # Re-export everything else unchanged.
54
+ build_wheel = _orig.build_wheel
55
+ build_editable = _orig.build_editable
56
+ get_requires_for_build_sdist = _orig.get_requires_for_build_sdist
57
+ get_requires_for_build_wheel = _orig.get_requires_for_build_wheel
58
+ get_requires_for_build_editable = _orig.get_requires_for_build_editable
59
+ prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
60
+ prepare_metadata_for_build_editable = _orig.prepare_metadata_for_build_editable
@@ -0,0 +1,74 @@
1
+ # atomic builtins are required for threading support.
2
+ INCLUDE(CheckCXXSourceCompiles)
3
+ INCLUDE(CheckLibraryExists)
4
+
5
+ function(check_working_cxx_atomics varname)
6
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
7
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
8
+ CHECK_CXX_SOURCE_COMPILES("
9
+ #include <atomic>
10
+ std::atomic<int> x;
11
+ std::atomic<short> y;
12
+ std::atomic<char> z;
13
+ int main() {
14
+ ++z;
15
+ ++y;
16
+ return ++x;
17
+ }
18
+ " ${varname})
19
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
20
+ endfunction(check_working_cxx_atomics)
21
+
22
+ function(check_working_cxx_atomics64 varname)
23
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
24
+ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}")
25
+ CHECK_CXX_SOURCE_COMPILES("
26
+ #include <atomic>
27
+ #include <cstdint>
28
+ std::atomic<uint64_t> x (0);
29
+ int main() {
30
+ uint64_t i = x.load(std::memory_order_relaxed);
31
+ (void)i;
32
+ return 0;
33
+ }
34
+ " ${varname})
35
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
36
+ endfunction(check_working_cxx_atomics64)
37
+
38
+ # Check for (non-64-bit) atomic operations.
39
+ if(MSVC)
40
+ set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
41
+ elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
42
+ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
43
+ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
44
+ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
45
+ if(HAVE_LIBATOMIC)
46
+ list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
47
+ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
48
+ if(NOT HAVE_CXX_ATOMICS_WITH_LIB)
49
+ message(FATAL_ERROR "Host compiler must support std::atomic!")
50
+ endif()
51
+ else()
52
+ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
53
+ endif()
54
+ endif()
55
+ endif()
56
+
57
+ # Check for 64-bit atomic operations.
58
+ if(MSVC)
59
+ set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
60
+ elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
61
+ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
62
+ if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
63
+ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
64
+ if(HAVE_CXX_LIBATOMICS64)
65
+ list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
66
+ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
67
+ if(NOT HAVE_CXX_ATOMICS64_WITH_LIB)
68
+ message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
69
+ endif()
70
+ else()
71
+ message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.")
72
+ endif()
73
+ endif()
74
+ endif()
@@ -0,0 +1,44 @@
1
+ set(CUDA_LIBRARY-NOTFOUND, OFF)
2
+ message(NOTICE "Finding CUDA environment")
3
+ message(NOTICE " - CUDA Home detected at $ENV{CUDA_HOME}")
4
+ set(CMAKE_CUDA_ARCHITECTURES "all")
5
+
6
+ # On Windows users should set -DCMAKE_CUDA_PATH="..." when configuring CMake.
7
+ # For all test setups CUPDLP_FIND_CUDA was not required on Windows.
8
+ if (NOT WIN32)
9
+ set(CMAKE_CUDA_PATH "$ENV{CUDA_HOME}")
10
+ endif()
11
+ # For local testing.
12
+ # set(CMAKE_CUDA_PATH "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.9")
13
+
14
+ # message(STATUS "CMAKE_CUDA_PATH ${CMAKE_CUDA_PATH}")
15
+
16
+ set(CMAKE_CUDA_COMPILER "${CMAKE_CUDA_PATH}/bin/nvcc")
17
+
18
+ enable_language(CUDA)
19
+
20
+ find_library(CUDA_LIBRARY_ART
21
+ NAMES cudart
22
+ HINTS "${CMAKE_CUDA_PATH}/lib64/"
23
+ HINTS "${CMAKE_CUDA_PATH}/lib/x64"
24
+ REQUIRED
25
+ )
26
+ find_library(CUDA_LIBRARY_SPS
27
+ NAMES cusparse
28
+ HINTS "${CMAKE_CUDA_PATH}/lib64/"
29
+ HINTS "${CMAKE_CUDA_PATH}/lib/x64/"
30
+ REQUIRED
31
+ )
32
+ find_library(CUDA_LIBRARY_BLS
33
+ NAMES cublas
34
+ HINTS "${CMAKE_CUDA_PATH}/lib64/"
35
+ HINTS "${CMAKE_CUDA_PATH}/lib/x64/"
36
+ REQUIRED
37
+ )
38
+ if (${CUDA_LIBRARY-NOTFOUND})
39
+ message(WARNING " - CUDA Libraries not detected at $ENV{CUDA_HOME}")
40
+ else ()
41
+ message(NOTICE " - CUDA Libraries detected at $ENV{CUDA_HOME}")
42
+ set(CUDA_LIBRARY ${CUDA_LIBRARY_ART} ${CUDA_LIBRARY_SPS} ${CUDA_LIBRARY_BLS})
43
+ message(NOTICE " - :${CUDA_LIBRARY}")
44
+ endif ()