-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from brenhinkeller/master
Linux fixes, update integration tests
- Loading branch information
Showing
13 changed files
with
410 additions
and
93 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
matrix: | ||
version: | ||
- '1.7' | ||
- '1.8.0-rc1' | ||
- '1.8.0-beta3' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
|
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
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
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,16 @@ | ||
using StaticCompiler | ||
using StaticTools | ||
|
||
function interop(argc, argv) | ||
lib = StaticTools.dlopen(c"libm") | ||
printf(lib) | ||
sin = StaticTools.dlsym(lib, c"sin") | ||
printf(sin) | ||
x = @ptrcall sin(5.0::Float64)::Float64 | ||
printf(x) | ||
newline() | ||
StaticTools.dlclose(lib) | ||
end | ||
|
||
# Attempt to compile | ||
path = compile_executable(interop, (Int64, Ptr{Ptr{UInt8}}), "./", cflags=`-ldl -lm`) |
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
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,49 @@ | ||
using StaticCompiler | ||
using StaticTools | ||
using LoopVectorization | ||
|
||
@inline function mul!(C::StackArray, A::StackArray, B::StackArray) | ||
@turbo for n ∈ indices((C,B), 2), m ∈ indices((C,A), 1) | ||
Cmn = zero(eltype(C)) | ||
for k ∈ indices((A,B), (2,1)) | ||
Cmn += A[m,k] * B[k,n] | ||
end | ||
C[m,n] = Cmn | ||
end | ||
return C | ||
end | ||
|
||
function loopvec_matrix_stack() | ||
rows = 10 | ||
cols = 5 | ||
|
||
# LHS | ||
A = StackArray{Float64}(undef, rows, cols) | ||
@turbo for i ∈ axes(A, 1) | ||
for j ∈ axes(A, 2) | ||
A[i,j] = i*j | ||
end | ||
end | ||
|
||
# RHS | ||
B = StackArray{Float64}(undef, cols, rows) | ||
@turbo for i ∈ axes(B, 1) | ||
for j ∈ axes(B, 2) | ||
B[i,j] = i*j | ||
end | ||
end | ||
|
||
# # Matrix multiplication | ||
C = StackArray{Float64}(undef, cols, cols) | ||
mul!(C, B, A) | ||
|
||
# Print to stdout | ||
printf(C) | ||
# Also print to file | ||
fp = fopen(c"table.tsv",c"w") | ||
printf(fp, C) | ||
fclose(fp) | ||
end | ||
|
||
# Attempt to compile | ||
path = compile_executable(loopvec_matrix_stack, (), "./") |
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
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
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,22 @@ | ||
using StaticCompiler | ||
using StaticTools | ||
|
||
function randn_matrix(argc::Int, argv::Ptr{Ptr{UInt8}}) | ||
argc == 3 || return printf(stderrp(), c"Incorrect number of command-line arguments\n") | ||
rows = argparse(Int64, argv, 2) # First command-line argument | ||
cols = argparse(Int64, argv, 3) # Second command-line argument | ||
|
||
M = MallocArray{Float64}(undef, rows, cols) | ||
rng = MarsagliaPolar(static_rng()) | ||
@inbounds for i=1:rows | ||
for j=1:cols | ||
M[i,j] = randn(rng) | ||
end | ||
end | ||
printf(M) | ||
free(M) | ||
end | ||
|
||
# Attempt to compile | ||
# cflags=`-lm`: need to explicitly include libm math library on linux | ||
path = compile_executable(randn_matrix, (Int64, Ptr{Ptr{UInt8}}), "./", cflags=`-lm`) |
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
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,31 @@ | ||
using StaticCompiler | ||
using StaticTools | ||
|
||
function withmallocarray(argc::Int, argv::Ptr{Ptr{UInt8}}) | ||
argc == 3 || return printf(stderrp(), c"Incorrect number of command-line arguments\n") | ||
rows = argparse(Int64, argv, 2) # First command-line argument | ||
cols = argparse(Int64, argv, 3) # Second command-line argument | ||
|
||
mzeros(rows, cols) do A | ||
printf(A) | ||
end | ||
mones(Int, rows, cols) do A | ||
printf(A) | ||
end | ||
mfill(3.141592, rows, cols) do A | ||
printf(A) | ||
end | ||
|
||
# Random number generation | ||
rng = MarsagliaPolar() | ||
mrand(rng, rows, cols) do A | ||
printf(A) | ||
end | ||
mrandn(rng, rows, cols) do A | ||
printf(A) | ||
end | ||
end | ||
|
||
# Attempt to compile | ||
# cflags=`-lm`: need to explicitly include libm math library on linux | ||
path = compile_executable(withmallocarray, (Int64, Ptr{Ptr{UInt8}}), "./", cflags=`-lm`) |
Oops, something went wrong.
38dbdbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register:
Release notes:
__stack_chk_guard
error (Linking error #83 )38dbdbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/70704
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: