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

Adding osx-arm support v3 #252

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5f38bbe
migration: OSXArm
regro-cf-autotick-bot Aug 23, 2022
ea8b31d
MNT: Re-rendered with conda-build 3.22.0, conda-smithy 3.21.1, and co…
regro-cf-autotick-bot Aug 23, 2022
4d24a10
Move curl to the build system
mkitti Sep 3, 2022
c6c522f
MNT: Re-rendered with conda-build 3.22.0, conda-smithy 3.21.1, and co…
Sep 3, 2022
72d3b30
Patch jldownload to use build env curl
mkitti Sep 3, 2022
7f3119b
Make jldownload less verbose
mkitti Sep 3, 2022
055c2d3
Make jldownload less verbose for real
mkitti Sep 3, 2022
d3c9551
Merge branch 'main' into mkitti/bot-pr_arm_osx_h9dcb98
mkitti Sep 30, 2022
8ba0707
MNT: Re-rendered with conda-build 3.24.0, conda-smithy 3.23.1, and co…
May 23, 2023
c7d0089
Merge branch 'main' into mkitti/bot-pr_arm_osx_h9dcb98
ngam May 23, 2023
4660908
try to fix cross-compile
ngam May 24, 2023
0b29649
MNT: Re-rendered with conda-build 3.24.0, conda-smithy 3.23.1, and co…
May 24, 2023
b0b5f48
Merge branch 'main' into mkitti/bot-pr_arm_osx_h9dcb98
ngam May 29, 2023
76187fc
add openlibm to build
ngam May 30, 2023
a0733ae
try vendoring openlibm for osx-arm
ngam May 30, 2023
0cdb481
correct logic
ngam May 30, 2023
b5226e4
correct logic
ngam May 30, 2023
77c6e4e
Add precompilation debug patch
MilesCranmer Jun 1, 2023
d802be6
Disable infinite while loop in precompilation
MilesCranmer Jun 1, 2023
97d3aad
Backport https://github.com/JuliaLang/julia/pull/49132
MilesCranmer Jun 1, 2023
bece65e
Fix backported patch to older Julia
MilesCranmer Jun 1, 2023
dce4669
Manually backport JuliaLang/julia#49132
MilesCranmer Jun 1, 2023
991caa1
Fix backported patch to older Julia
MilesCranmer Jun 1, 2023
99fe7b7
Fix formatting issue in patch file
MilesCranmer Jun 1, 2023
3fc0512
Fix MPFR version
MilesCranmer Jun 2, 2023
07fdc0d
add mpfr
ngam Jun 2, 2023
d09d79c
MNT: Re-rendered with conda-build 3.25.0, conda-smithy 3.23.1, and co…
Jun 2, 2023
9f90b8a
we only have 4.1.0
ngam Jun 2, 2023
4ab5292
MNT: Re-rendered with conda-build 3.24.0, conda-smithy 3.23.1, and co…
ngam Jun 2, 2023
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
4 changes: 4 additions & 0 deletions .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ libssh2:
libunwind:
- '1.6'
mpfr:
- '4'
- 4.1.0
pcre2:
- '10.40'
perl:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ libssh2:
macos_machine:
- x86_64-apple-darwin13.4.0
mpfr:
- '4'
- 4.1.0
pcre2:
- '10.40'
perl:
Expand Down
44 changes: 44 additions & 0 deletions .ci_support/osx_arm64_.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
MACOSX_DEPLOYMENT_TARGET:
- '11.0'
arpack:
- '3.7'
c_compiler:
- clang
c_compiler_version:
- '15'
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
curl:
- '8'
cxx_compiler:
- clangxx
cxx_compiler_version:
- '15'
fortran_compiler:
- gfortran
fortran_compiler_version:
- '12'
gmp:
- '6'
libssh2:
- '1'
macos_machine:
- arm64-apple-darwin20.0.0
mpfr:
- 4.1.0
pcre2:
- '10.40'
perl:
- 5.32.1
suitesparse:
- '5'
target_platform:
- osx-arm64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
zlib:
- '1.2'
7 changes: 7 additions & 0 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions conda-forge.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
azure:
store_build_artifacts: true
build_platform:
osx_arm64: osx_64
conda_forge_output_validation: true
github:
branch_name: main
Expand Down
9 changes: 5 additions & 4 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export CMAKE_GENERATOR="make"
make -C base version_git.jl.phony CC=$CC CXX=$CXX FC=$FC

export EXTRA_MAKEFLAGS=""
if [[ "${target_platform}" == osx-* ]]; then
export EXTRA_MAKEFLAGS="USE_SYSTEM_LIBGIT2=0 USE_SYSTEM_MBEDTLS=0"
if [[ "${target_platform}" == osx-arm64 ]]; then
export EXTRA_MAKEFLAGS="USE_SYSTEM_LIBGIT2=0 USE_SYSTEM_MBEDTLS=0 USE_SYSTEM_OPENLIBM=0"
elif [[ "${target_platform}" == osx-* ]]; then
export EXTRA_MAKEFLAGS="USE_SYSTEM_LIBGIT2=0 USE_SYSTEM_MBEDTLS=0 USE_SYSTEM_OPENLIBM=1"
elif [[ "${target_platform}" == linux-* ]]; then
export EXTRA_MAKEFLAGS="USE_SYSTEM_LIBGIT2=1 USE_SYSTEM_MBEDTLS=1"
export EXTRA_MAKEFLAGS="USE_SYSTEM_LIBGIT2=1 USE_SYSTEM_MBEDTLS=1 USE_SYSTEM_OPENLIBM=1"
fi
# See the following link for how official Julia sets JULIA_CPU_TARGET
# https://github.com/JuliaCI/julia-buildbot/blob/ba448c690935fe53d2b1fc5ce22bc60fd1e251a7/master/inventory.py
Expand Down Expand Up @@ -43,7 +45,6 @@ make -j${CPU_COUNT} prefix=${PREFIX} sysconfigdir=${PREFIX}/etc \
USE_SYSTEM_LIBSSH2=1 \
USE_SYSTEM_LLVM=0 \
USE_SYSTEM_MPFR=0 \
USE_SYSTEM_OPENLIBM=1 \
USE_SYSTEM_PATCHELF=1 \
USE_SYSTEM_PCRE=1 \
USE_SYSTEM_LIBSUITESPARSE=1 \
Expand Down
2 changes: 2 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ libunwind: # [linux]
pin_run_as_build: # [linux]
libunwind: # [linux]
max_pin: x.x # [linux]
mpfr:
- 4.1.0
9 changes: 9 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ source:
## issues with this precompile test, see https://github.com/JuliaLang/julia/issues/43535
- patches/0002-disable-testing-Baz.baz-1.patch # [linux]
- patches/julia-libunwind-1.6.patch # [linux]
- patches/0004-Force-use-of-build-env-curl.patch
- patches/0003-Defer-codesigning-to-conda-forge.patch # [osx]
- patches/debug-precompilation.patch # [osx]
- patches/0001-Manually-backport-JuliaLang-julia-49132.patch

build:
skip: true # [win]
Expand All @@ -29,7 +32,11 @@ requirements:
build:
- make
- perl
- curl
- python 3
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- git # [build_platform != target_platform]
- openlibm # [build_platform != target_platform]
- {{ compiler('fortran') }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
Expand All @@ -52,6 +59,7 @@ requirements:
- libnghttp2
- zlib
- p7zip
- mpfr

run:
- openblas-ilp64
Expand All @@ -71,6 +79,7 @@ requirements:
- libnghttp2
- zlib
- p7zip
- mpfr

test:
commands:
Expand Down
197 changes: 197 additions & 0 deletions recipe/patches/0001-Manually-backport-JuliaLang-julia-49132.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
From c0e8974c094b20405c21db858dec55ac03082199 Mon Sep 17 00:00:00 2001
From: MilesCranmer <[email protected]>
Date: Thu, 1 Jun 2023 17:52:58 -0400
Subject: [PATCH] Manually backport JuliaLang/julia#49132

---
base/Base.jl | 28 +++++++++++++++++++++
base/sysimg.jl | 1 -
contrib/generate_precompile.jl | 14 -----------
stdlib/Profile/src/Profile.jl | 40 +-------------------------------
stdlib/Profile/src/precompile.jl | 5 ++++
test/precompile.jl | 2 +-
6 files changed, 35 insertions(+), 55 deletions(-)
create mode 100644 stdlib/Profile/src/precompile.jl

diff --git a/base/Base.jl b/base/Base.jl
index d04b6ff666..c1caeb5282 100644
--- a/base/Base.jl
+++ b/base/Base.jl
@@ -518,6 +518,27 @@ for match = _methods(+, (Int, Int), -1, get_world_counter())
end

if is_primary_base_module
+
+# triggers printing the report and (optionally) saving a heap snapshot after a SIGINFO/SIGUSR1 profile request
+const PROFILE_PRINT_COND = Ref{Base.AsyncCondition}()
+function profile_printing_listener()
+ try
+ while true
+ wait(PROFILE_PRINT_COND[])
+ peek_report[]()
+ if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1"
+ println(stderr, "Saving heap snapshot...")
+ fname = take_heap_snapshot()
+ println(stderr, "Heap snapshot saved to `$(fname)`")
+ end
+ end
+ catch ex
+ if !isa(ex, InterruptException)
+ @error "Profile printing listener crashed" exception=ex,catch_backtrace()
+ end
+ end
+end
+
function __init__()
# Base library init
reinit_stdio()
@@ -530,6 +555,13 @@ function __init__()
if haskey(ENV, "JULIA_MAX_NUM_PRECOMPILE_FILES")
MAX_NUM_PRECOMPILE_FILES[] = parse(Int, ENV["JULIA_MAX_NUM_PRECOMPILE_FILES"])
end
+ # Profiling helper
+ @static if !Sys.iswindows()
+ # triggering a profile via signals is not implemented on windows
+ PROFILE_PRINT_COND[] = Base.AsyncCondition()
+ ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
+ errormonitor(Threads.@spawn(profile_printing_listener()))
+ end
nothing
end

diff --git a/base/sysimg.jl b/base/sysimg.jl
index ef7bad929b..d91f4b09ae 100644
--- a/base/sysimg.jl
+++ b/base/sysimg.jl
@@ -58,7 +58,6 @@ let
:Future,
:InteractiveUtils,
:LibGit2,
- :Profile,
:SparseArrays,
:UUIDs,

diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl
index 0a0941aa97..d78461ef6b 100644
--- a/contrib/generate_precompile.jl
+++ b/contrib/generate_precompile.jl
@@ -222,20 +222,6 @@ if Test !== nothing
"""
end

-Profile = get(Base.loaded_modules,
- Base.PkgId(Base.UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile"),
- nothing)
-if Profile !== nothing
- repl_script *= Profile.precompile_script
- hardcoded_precompile_statements *= """
- precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Int, UInt})
- precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Int, UnitRange{UInt}})
- precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, UnitRange{Int}, UInt})
- precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, UnitRange{Int}, UnitRange{UInt}})
- precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Vector{Int}, Vector{UInt}})
- """
-end
-
const JULIA_PROMPT = "julia> "
const PKG_PROMPT = "pkg> "
const SHELL_PROMPT = "shell> "
diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl
index ba2d7390a2..f6c4069f26 100644
--- a/stdlib/Profile/src/Profile.jl
+++ b/stdlib/Profile/src/Profile.jl
@@ -31,26 +31,6 @@ macro profile(ex)
end
end

-# triggers printing the report and (optionally) saving a heap snapshot after a SIGINFO/SIGUSR1 profile request
-const PROFILE_PRINT_COND = Ref{Base.AsyncCondition}()
-function profile_printing_listener()
- try
- while true
- wait(PROFILE_PRINT_COND[])
- peek_report[]()
- if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1"
- println(stderr, "Saving heap snapshot...")
- fname = take_heap_snapshot()
- println(stderr, "Heap snapshot saved to `$(fname)`")
- end
- end
- catch ex
- if !isa(ex, InterruptException)
- @error "Profile printing listener crashed" exception=ex,catch_backtrace()
- end
- end
-end
-
# An internal function called to show the report after an information request (SIGINFO or SIGUSR1).
function _peek_report()
iob = IOBuffer()
@@ -74,13 +54,6 @@ Set the duration in seconds of the profile "peek" that is triggered via `SIGINFO
"""
set_peek_duration(t::Float64) = ccall(:jl_set_profile_peek_duration, Cvoid, (Float64,), t)

-precompile_script = """
-import Profile
-Profile.@profile while Profile.len_data() < 1000; rand(10,10) * rand(10,10); end
-Profile.peek_report[]()
-Profile.clear()
-"""
-
####
#### User-level functions
####
@@ -150,18 +123,6 @@ function check_init()
end
end

-function __init__()
- # Note: The profile buffer is no longer initialized during __init__ because Profile is in the sysimage,
- # thus __init__ is called every startup. The buffer is lazily initialized the first time `@profile` is
- # used, if not manually initialized before that.
- @static if !Sys.iswindows()
- # triggering a profile via signals is not implemented on windows
- PROFILE_PRINT_COND[] = Base.AsyncCondition()
- ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
- errormonitor(Threads.@spawn(profile_printing_listener()))
- end
-end
-
"""
clear()

@@ -1265,5 +1226,6 @@ end


include("Allocs.jl")
+include("precompile.jl")

end # module
diff --git a/stdlib/Profile/src/precompile.jl b/stdlib/Profile/src/precompile.jl
new file mode 100644
index 0000000000..cc750937af
--- /dev/null
+++ b/stdlib/Profile/src/precompile.jl
@@ -0,0 +1,5 @@
+precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Int, UInt})
+precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Int, UnitRange{UInt}})
+precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, UnitRange{Int}, UInt})
+precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, UnitRange{Int}, UnitRange{UInt}})
+precompile(Tuple{typeof(Profile.tree!), Profile.StackFrameTree{UInt64}, Vector{UInt64}, Dict{UInt64, Vector{Base.StackTraces.StackFrame}}, Bool, Symbol, Vector{Int}, Vector{UInt}})
\ No newline at end of file
diff --git a/test/precompile.jl b/test/precompile.jl
index 006c0ae06c..030bbb5c53 100644
--- a/test/precompile.jl
+++ b/test/precompile.jl
@@ -387,7 +387,7 @@ precompile_test_harness(false) do dir
:Distributed, :Downloads, :FileWatching, :Future, :InteractiveUtils, :libblastrampoline_jll,
:LazyArtifacts, :LibCURL, :LibCURL_jll, :LibGit2, :Libdl, :LinearAlgebra,
:Logging, :Markdown, :Mmap, :MozillaCACerts_jll, :NetworkOptions, :OpenBLAS_jll, :Pkg, :Printf,
- :Profile, :p7zip_jll, :REPL, :Random, :SHA, :Serialization, :SharedArrays, :Sockets,
+ :p7zip_jll, :REPL, :Random, :SHA, :Serialization, :SharedArrays, :Sockets,
:SparseArrays, :TOML, :Tar, :Test, :UUIDs, :Unicode,
:nghttp2_jll]
),
--
2.39.0

26 changes: 26 additions & 0 deletions recipe/patches/0004-Force-use-of-build-env-curl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From e50a1c6fb20608e1d909797b554637969aa980c7 Mon Sep 17 00:00:00 2001
From: Mark Kittisopikul <[email protected]>
Date: Fri, 2 Sep 2022 20:45:50 -0400
Subject: [PATCH] Force use of build env curl

---
deps/tools/jldownload | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/deps/tools/jldownload b/deps/tools/jldownload
index 99822195fe..7a32f499c6 100755
--- a/deps/tools/jldownload
+++ b/deps/tools/jldownload
@@ -6,7 +6,8 @@
CACHE_HOST=https://cache.julialang.org

WGET=$(which wget 2>/dev/null)
-CURL=$(which curl 2>/dev/null)
+#CURL=$(which curl 2>/dev/null)
+CURL=$CONDA_PREFIX/bin/curl
FETCH=$(which fetch 2>/dev/null)

TIMEOUT=15 # seconds
--
2.32.1 (Apple Git-133)

Loading