-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get lib example working, create build script (#55104)
Note this is a PR against #55047 Co-authored by: Gabriel Baraldi <baraldigabriel@gmail.com>
- Loading branch information
Showing
5 changed files
with
37 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[deps] | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
OpenBLAS_jll = "4536629a-c528-5b80-bd46-f80d51c5b363" | ||
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" | ||
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" | ||
StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/bash | ||
if [ ! -f Manifest.toml ]; then | ||
echo "Instantiating package environment..." | ||
../../../julia --project -e 'using Pkg; Pkg.instantiate()' | ||
echo "done" | ||
fi | ||
echo "Building library..." | ||
../../../julia --project ../../juliac.jl --output-lib liblinsolve --compile-ccallable --static-call-graph liblinsolve.jl | ||
echo "done" | ||
echo "Linking C main..." | ||
gcc -o linsolve10 -L. -Wl,-rpath,\$ORIGIN ../../test/test.c -llinsolve | ||
echo "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Lib | ||
|
||
using LinearAlgebra | ||
|
||
Base.@ccallable function linsolve10(A_ptr::Ptr{Float64}, b_ptr::Ptr{Float64}, N::Csize_t)::Ptr{Float64} | ||
A = unsafe_wrap(Array, A_ptr, (N,N)) | ||
b = unsafe_wrap(Array, b_ptr, N) | ||
F = lu!(A) | ||
ldiv!(F, b) | ||
return b_ptr | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters