Skip to content

Commit

Permalink
Merge pull request #1 from tmmsartor/main
Browse files Browse the repository at this point in the history
Various updates
  • Loading branch information
jgillis authored Jul 31, 2024
2 parents 207d7c6 + 831881c commit 3c6eed6
Show file tree
Hide file tree
Showing 16 changed files with 982 additions and 602 deletions.
40 changes: 23 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
name: build

on: [push, pull_request]
permissions: write-all

on: push

jobs:
build:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- '1.10.4'
os:
- windows-2022
- ubuntu-20.04
#- macos-11
- macos-12
- macos-14
arch:
- x64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
Expand All @@ -33,22 +35,26 @@ jobs:
julia --startup-file=no --project=compiler -e 'using Pkg; Pkg.instantiate()'
julia --startup-file=no --project=compiler compiler/build.jl foo
# Upload as release asset
- uses: vimtor/[email protected]
#- uses: vimtor/[email protected]
# with:
# files: foo/
# recursive: true
# dest: foo.zip
- name: zip_with_symlinks
run: |
zip --symlinks -r foo.zip foo/
- uses: actions/[email protected]
with:
files: foo/
recursive: true
dest: foo.zip
name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }}
path: foo.zip
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Upload files to a GitHub release
uses: svenstaro/[email protected]
with:
overwrite: true
tag: v0.1
tag: nightly-${{ env.GITHUB_REF_SLUG }}
file: foo.zip
asset_name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }}.zip
prerelease: true

- uses: actions/[email protected]
with:
name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }}
path: foo
repo_token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
.ccls-cache
compile_commands.json
.*.sw[a-z]
target/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "MadNLP.jl"]
path = MadNLP.jl
url = https://github.com/tmmsartor/MadNLP.jl.git
88 changes: 83 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,91 @@
cmake_minimum_required(VERSION 3.12)
project(MadNLP_C VERSION 1.0.0) # Adjust the version as necessary
project(MadNLP_C VERSION 0.1.0) # Adjust the version as necessary

set(Julia_EXECUTABLE julia)
message(CHECK_START "Check Julia Executable")
set(JULIA_EXECUTABLE "julia" CACHE STRING "Julia executable default")
if (JULIA_EXECUTABLE STREQUAL "julia")
execute_process(
COMMAND which julia
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE JULIA_EXECUTABLE_PARSED
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(JULIA_EXECUTABLE ${JULIA_EXECUTABLE_PARSED} CACHE STRING "Julia executable" FORCE)
endif()
message(CHECK_PASS ${JULIA_EXECUTABLE})

message(CHECK_START "Check Julia binary dir")
set(JULIA_BIN_DIR "nd" CACHE STRING "Julia runtime binary dir default")
if (JULIA_BIN_DIR STREQUAL "nd")
execute_process(
COMMAND ${JULIA_EXECUTABLE} --startup-file=no -e "print(dirname(Sys.BINDIR))"
OUTPUT_VARIABLE JULIA_BIN_DIR_PARSED
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(JULIA_BIN_DIR ${JULIA_BIN_DIR_PARSED} CACHE STRING "Julia runtime binary dir" FORCE)
endif()
message(CHECK_PASS ${JULIA_BIN_DIR})

message(CHECK_START "Check MadNLP.jl version")
set(MADNLP_VERSION "nd" CACHE STRING "MadNLP Julia Library Version")
if (MADNLP_VERSION STREQUAL "nd")
execute_process(
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.instantiate();m=Pkg.dependencies();v=m[findfirst(v->v.name==\"MadNLP\",m)].version; print(v);"
OUTPUT_VARIABLE MADNLP_VERSION_PARSED
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(MADNLP_VERSION ${MADNLP_VERSION_PARSED} CACHE STRING "MadNLP Julia Library Version" FORCE)
endif()
message(CHECK_PASS ${MADNLP_VERSION})

set(MADNLP_C_FULLNAME madnlp_c-${MADNLP_VERSION}-${PROJECT_VERSION})
set(BUILD_SCRIPT ${PROJECT_SOURCE_DIR}/compiler/build.jl)

add_custom_command(
OUTPUT FOO
COMMAND ${Julia_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()"
OUTPUT ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt
DEPENDS ${PROJECT_SOURCE_DIR}/Manifest.toml
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.instantiate()"
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.status()" > ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Instantiating Julia packages"
COMMENT "Instantiate Julia packages"
VERBATIM
)

add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt
DEPENDS ${PROJECT_SOURCE_DIR}/Manifest.toml
DEPENDS ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ compiler/generate_precompile.jl > ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Parses Julia packages"
VERBATIM
)

add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt
DEPENDS ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/Manifest.toml
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()"
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.status()" > ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Instantiate Julia build packages"
VERBATIM
)

add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt
DEPENDS ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt
DEPENDS ${PROJECT_SOURCE_DIR}/src/MadNLP_C.jl
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/build.jl
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/generate_precompile.jl
DEPENDS ${PROJECT_SOURCE_DIR}/.git/modules/MadNLP.jl/HEAD
COMMAND echo 1 > ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler ${BUILD_SCRIPT} ${PROJECT_BINARY_DIR}/${MADNLP_C_FULLNAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Create Madnlp precompiled library sysimage"
VERBATIM
)

add_custom_target(madnlp_c ALL
DEPENDS ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt
)
1 change: 1 addition & 0 deletions MadNLP.jl
Submodule MadNLP.jl added at 5d54c1
53 changes: 30 additions & 23 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.3"
julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "2dcfd936fdff6ca235a0071d4470e333b9cac885"
project_hash = "11e2fdfc8c6a8311d5289aad1e318ca97da92785"

[[deps.AMD]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse_jll"]
Expand Down Expand Up @@ -109,15 +109,15 @@ version = "0.14.1+0"

[[deps.CUDSS]]
deps = ["CEnum", "CUDA", "CUDSS_jll", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "2ddfb9e1bab8cd6a049c4bd0bc0f5f7d91640e9c"
git-tree-sha1 = "dcb28fb99501ce47c7a4e25e5fdf94b0e8dfa749"
uuid = "45b445bb-4962-46a0-9369-b4df9d0f772e"
version = "0.1.6"
version = "0.3.1"

[[deps.CUDSS_jll]]
deps = ["Artifacts", "CUDA_Runtime_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"]
git-tree-sha1 = "7d82cd3ec956d1dc36bdb1887561112fa1b10df7"
git-tree-sha1 = "b4c1defa52f8806ac674ac72c793e9b5599c6e81"
uuid = "4889d778-9329-5762-9fec-0578a5d30366"
version = "0.1.0+0"
version = "0.3.0+0"

[[deps.CUSOLVERRF]]
deps = ["CUDA", "KLU", "LinearAlgebra", "SparseArrays"]
Expand Down Expand Up @@ -259,9 +259,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"

[[deps.GPUArrays]]
deps = ["Adapt", "GPUArraysCore", "LLVM", "LinearAlgebra", "Printf", "Random", "Reexport", "Serialization", "Statistics"]
git-tree-sha1 = "04661708f5301394a1f1be86a07a89e835900db6"
git-tree-sha1 = "a74c3f1cf56a3dfcdef0605f8cdb7015926aae30"
uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
version = "10.2.3"
version = "10.3.0"

[[deps.GPUArraysCore]]
deps = ["Adapt"]
Expand All @@ -276,16 +276,17 @@ uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "0.26.7"

[[deps.InlineStrings]]
deps = ["Parsers"]
git-tree-sha1 = "86356004f30f8e737eff143d57d41bd580e437aa"
git-tree-sha1 = "45521d31238e87ee9f9732561bfee12d4eebd52d"
uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48"
version = "1.4.1"
version = "1.4.2"

[deps.InlineStrings.extensions]
ArrowTypesExt = "ArrowTypes"
ParsersExt = "Parsers"

[deps.InlineStrings.weakdeps]
ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd"
Parsers = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
Expand Down Expand Up @@ -475,24 +476,24 @@ uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.13"

[[deps.MadNLP]]
deps = ["LDLFactorizations", "LinearAlgebra", "Logging", "NLPModels", "Pkg", "Printf", "SolverCore", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "fa67a762e22c9c6c726b87ca8a335659ea6a69e0"
deps = ["LDLFactorizations", "LinearAlgebra", "Logging", "NLPModels", "Pkg", "Printf", "RelocatableFolders", "SolverCore", "SparseArrays", "SuiteSparse"]
path = "MadNLP.jl"
uuid = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
version = "0.8.3"
version = "0.8.4"
weakdeps = ["MathOptInterface"]

[deps.MadNLP.extensions]
MadNLPMOI = "MathOptInterface"

[[deps.MadNLPGPU]]
deps = ["AMD", "CUDA", "CUDSS", "CUSOLVERRF", "KernelAbstractions", "LinearAlgebra", "MadNLP", "MadNLPTests", "Metis", "SparseArrays"]
git-tree-sha1 = "ddb1981f1c7a2ba78e480d4d210353133b013d98"
git-tree-sha1 = "542846a6ecbaa6cbd7f3dbc6f86301b82b934a78"
uuid = "d72a61cc-809d-412f-99be-fd81f4b8a598"
version = "0.7.2"
version = "0.7.3"

[[deps.MadNLPMumps]]
deps = ["LinearAlgebra", "MUMPS_seq_jll", "MadNLP", "OpenBLAS32_jll"]
git-tree-sha1 = "a32f32cbd0ee36becf88368ce9d1e84e9bc6a0c1"
deps = ["LinearAlgebra", "MUMPS_seq_jll", "MadNLP", "OpenBLAS32_jll", "RelocatableFolders"]
path = "MadNLP.jl/lib/MadNLPMumps"
uuid = "3b83494e-c0a4-4895-918b-9157a7a085a1"
version = "0.4.1"

Expand Down Expand Up @@ -681,6 +682,12 @@ git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"

[[deps.RelocatableFolders]]
deps = ["SHA", "Scratch"]
git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864"
uuid = "05181044-ff0b-4ac5-8273-598c1e38db00"
version = "1.0.1"

[[deps.Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7"
Expand Down Expand Up @@ -789,10 +796,10 @@ uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.1"

[[deps.Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits"]
git-tree-sha1 = "cb76cf677714c095e535e3501ac7954732aeea2d"
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"]
git-tree-sha1 = "598cd7c1f68d1e205689b1c2fe65a9f85846f297"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.11.1"
version = "1.12.0"

[[deps.Tar]]
deps = ["ArgTools", "SHA"]
Expand All @@ -810,9 +817,9 @@ uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
version = "0.5.24"

[[deps.TranscodingStreams]]
git-tree-sha1 = "60df3f8126263c0d6b357b9a1017bb94f53e3582"
git-tree-sha1 = "96612ac5365777520c3c5396314c8cf7408f436a"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.11.0"
version = "0.11.1"
weakdeps = ["Random", "Test"]

[deps.TranscodingStreams.extensions]
Expand Down
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ version = "0.1.0"

[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
MadNLPGPU = "d72a61cc-809d-412f-99be-fd81f4b8a598"
MadNLPMumps = "3b83494e-c0a4-4895-918b-9157a7a085a1"
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
UnsafePointers = "e17b2a0c-0bdf-430a-bd0c-3a23cae4ff39"

[extras]
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
13 changes: 5 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
Project.toml is manually created
Manifest.toml is generated automatically from
julia> using Pkg
julia> Pkg.activate(".")
julia> Pkg.instantiate()


something similar in compiler


julia --startup-file=no --project=compiler compiler/build.jl foo
```
julia --startup-file=no --project=. -e "using Pkg; Pkg.instantiate()"
julia --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()"
julia --startup-file=no --project=compiler compiler/build.jl target/
```
8 changes: 5 additions & 3 deletions compiler/Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.3"
julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "9ddee98f4175ce3934d72d17e69fc38f7697d471"

Expand Down Expand Up @@ -88,9 +88,11 @@ version = "1.2.0"

[[deps.PackageCompiler]]
deps = ["Artifacts", "Glob", "LazyArtifacts", "Libdl", "Pkg", "Printf", "RelocatableFolders", "TOML", "UUIDs", "p7zip_jll"]
git-tree-sha1 = "48d4429862157ad5500c4f61444db1b8c32e0a2b"
git-tree-sha1 = "abee35bbb4be5c9c670bae87dee6a2384398cd64"
repo-rev = "xcode-flag-fix"
repo-url = "https://github.com/jayscook/PackageCompiler.jl"
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "2.1.17"
version = "2.1.18"

[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
Expand Down
Loading

0 comments on commit 3c6eed6

Please sign in to comment.