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 #224

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

mkitti
Copy link
Contributor

@mkitti mkitti commented Sep 3, 2022

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@mkitti
Copy link
Contributor Author

mkitti commented Sep 3, 2022

@conda-forge-admin, please rerender

conda-forge-webservices[bot] and others added 2 commits September 3, 2022 00:10
@mkitti
Copy link
Contributor Author

mkitti commented Sep 3, 2022

@conda-forge-admin, please rerender

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2022

Hi! This is the friendly automated conda-forge-webservice.

I tried to rerender for you, but it looks like there was nothing to do.

This message was generated by GitHub actions workflow run https://github.com/conda-forge/julia-feedstock/actions/runs/2982651707.

@mkitti
Copy link
Contributor Author

mkitti commented Sep 3, 2022

@conda-forge-admin, please rerender

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2022

Hi! This is the friendly automated conda-forge-webservice.

I tried to rerender for you, but it looks like there was nothing to do.

This message was generated by GitHub actions workflow run https://github.com/conda-forge/julia-feedstock/actions/runs/2982709690.

@ngam
Copy link
Contributor

ngam commented Sep 29, 2022

@mkitti do you want to give this a shot as a native build? Not emulated

@ngam
Copy link
Contributor

ngam commented Sep 29, 2022

Here are minimal steps to get you started:

  1. clone this repo (main)
  2. add the following to conda-forge.yml
build_platform:
  osx_arm64: osx_64
test: native_and_emulated
  1. rerender (conda smithy rerender)
  2. make sure to have conda-build (or boa for mambabuild)
  3. in root, conda-build recipe --variant-config-file .ci_support/osx_arm64_.yaml

For me, like before, this procedure gets stuck at

    JULIA usr/lib/julia/corecompiler.ji

... but we should be able to build this!

In file included from /Users/ngam/.Mambaforge-MacOSX-arm64/envs/py310/conda-bld/julia_1664495424314/work/src/ircode.c:11:
./serialize.h:112:13: warning: unused function 'write_uint32' [-Wunused-function]
static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
            ^
./serialize.h:117:17: warning: unused function 'read_uint32' [-Wunused-function]
static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
                ^
2 warnings generated.
    LINK usr/lib/libjulia-internal.1.8.dylib
ld: warning: -pie being ignored. It is only used when linking a main executable
[cctools-port]: generating fake signature for '/Users/ngam/.Mambaforge-MacOSX-arm64/envs/py310/conda-bld/julia_1664495424314/work/usr/lib/libjulia-internal.1.8.dylib'
    LINK usr/lib/libjulia-internal.1.dylib
    LINK usr/lib/libjulia-internal.dylib
1 warning generated.
    LINK usr/lib/libjulia-codegen.1.8.dylib
ld: warning: -pie being ignored. It is only used when linking a main executable
[cctools-port]: generating fake signature for '/Users/ngam/.Mambaforge-MacOSX-arm64/envs/py310/conda-bld/julia_1664495424314/work/usr/lib/libjulia-codegen.1.8.dylib'
    LINK usr/lib/libjulia-codegen.1.dylib
    LINK usr/lib/libjulia-codegen.dylib
make[2]: Leaving directory '$SRC_DIR/src'
make[2]: Entering directory '$SRC_DIR'
Warning: git information unavailable; versioning information limited
    JULIA usr/lib/julia/corecompiler.ji

@MilesCranmer
Copy link

Hey @ngam @mkitti, how much work do you think it will be to get this working? Most of the new Apple products are exclusively ARM-based, so I am thinking it will be a good idea to have conda capability set up relatively soon.

@mkitti
Copy link
Contributor Author

mkitti commented Jan 17, 2023

I do have the hardware. I suppose I should try to build this and see if I can figure out where it gets stuck.

@MilesCranmer
Copy link

Hey @mkitti, what is the status of this? Anything I can help with?
Cheers,
Miles

@MilesCranmer
Copy link

Took a stab at trying to build this, but am getting this weird issue (maybe just a local issue):

Linking ncurses-6.3-headf329_1
critical libmamba filesystem error: cannot copy: Input/output error [/workspace/miniforge3/pkgs/ncurses-6.3-headf329_1/share/terminfo/e/eterm-color] [/workspace/miniforge3/share/terminfo/e/eterm-color]
Traceback (most recent call last):
  File "/workspace/./build-locally.py", line 105, in <module>
    main()
  File "/workspace/./build-locally.py", line 95, in main
    run_osx_build(ns)
  File "/workspace/./build-locally.py", line 34, in run_osx_build
    subprocess.check_call([script])
  File "/opt/conda/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['.scripts/run_osx_build.sh']' returned non-zero exit status 1.

@ngam
Copy link
Contributor

ngam commented May 23, 2023

@conda-forge-admin, please rerender

@ngam ngam changed the title Mkitti/bot pr arm osx h9dcb98 Adding osx-arm support May 23, 2023
@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

Is there a blocker to building openlibm for macos-arm in conda-forge?

@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

Are we cross compiling?

@ngam
Copy link
Contributor

ngam commented May 30, 2023

Is there a blocker to building openlibm for macos-arm in conda-forge?

It's already available: https://anaconda.org/conda-forge/openlibm/files

recipe/build.sh Outdated Show resolved Hide resolved
recipe/build.sh Outdated Show resolved Hide resolved
ngam and others added 2 commits May 29, 2023 22:04
Co-authored-by: Mark Kittisopikul <[email protected]>
Co-authored-by: Mark Kittisopikul <[email protected]>
@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

It's already available: https://anaconda.org/conda-forge/openlibm/files

So the problem is that Julia cannot find openlibm.dylib?

@ngam
Copy link
Contributor

ngam commented May 30, 2023

It's already available: https://anaconda.org/conda-forge/openlibm/files

So the problem is that Julia cannot find openlibm.dylib?

It may be that it is finding the "wrong" one because we are cross-compiling

@ngam
Copy link
Contributor

ngam commented May 30, 2023

I am also trying to build locally natively, so we will see how that goes...

@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

It may be that it is finding the "wrong" one because we are cross-compiling

I'm not sure if Julia will cross compile. We're going to get stuck at building the system image.

@ngam
Copy link
Contributor

ngam commented May 30, 2023

Do you know what would stop the building at Generating REPL precompile statements... 38/41? What's it doing in these steps anyway?

@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

JuliaLang/julia#30338

@staticfloat, are we any closer to cross compiling?

@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

Do you know what would stop the building at Generating REPL precompile statements... 38/41? What's it doing in these steps anyway?

It's running the REPL and tracing what method specializations were compiled while doing so. This generates a series of calls to Base.precompile so that these compiled methods get cached within the system image, sys.{dll,so,dylib}. This makes the REPL fast to start without compilation latency.

@ngam
Copy link
Contributor

ngam commented May 30, 2023

Well... I guess it is a moot effort for the time being. Let me know if you make any progress on this front.

@staticfloat
Copy link

Julia can cross-compile as long as you can execute the generated executable; so e.g. if you have rosetta available, I think you can cross-compile Julia x86_64 on aarch64. I'm not sure what kind of cross-compilation is happening here though.

@mkitti
Copy link
Contributor Author

mkitti commented May 30, 2023

I think we're cross compiling from a x86_64 Azure host running macOS for an aarch64 macOS target.

@MilesCranmer
Copy link

@conda-forge/help-osx-arm64 is there any way we can use a self-hosted macOS agent for building the arm64 binaries? Or is there a way we can upload binaries manually?

Unless I misunderstand @staticfloat it sounds like Julia may not support osx-64 => osx-arm64 cross-compilation right now. But osx-arm64 => osx-arm64 builds seem to be working.

@MilesCranmer
Copy link

MilesCranmer commented Jun 1, 2023

@ngam @mkitti I also get stuck at 38/41 of the precompilation. This tip might provide some debugging info: JuliaLang/julia#37777 (comment)

Edit: it gets stuck here:

       Profile.@profile while Profile.len_data() < 1000; rand(10,10) * rand(10,10); end

This seems like a bad idea for a precompilation statement... It's an infinite while loop. I guess the profiler isn't getting any samples out of this.


Edit: I will add the following patch file to this branch:

- debug_output = devnull # or stdout
+ debug_output = stdout

mkitti#3

@ngam
Copy link
Contributor

ngam commented Jun 1, 2023

@MilesCranmer could you point your PR to this repo?

@MilesCranmer
Copy link

MilesCranmer commented Jun 1, 2023

Sure. Also I added a patch for the infinite precompilation (I'm going to patch this in Julia too, it seems like it is maybe not a great idea to have a unbounded while loop during precompilation...)


Edit: looks like they actually patched it already.

@MilesCranmer
Copy link

#252

@ngam
Copy link
Contributor

ngam commented Jun 2, 2023

is there any way we can use a self-hosted macOS agent for building the arm64 binaries? Or is there a way we can upload binaries manually?

@MilesCranmer we do this for quite a few difficult packages (e.g., PyTorch, TensorFlow, and at least at some point QT) that are usually impossible to build within 6 hours of free public CI. There is a procedure outlined somewhere (under a CFEP, conda-forge enhancement proposal). Once we test the package in #252, I will tag the appropriate people to make it happen and formalize it.

Unless I misunderstand @staticfloat it sounds like Julia may not support osx-64 => osx-arm64 cross-compilation right now.

Thanks @staticfloat and @mkitti; is there an issue upstream to follow progress on this front? Do we think it's happening soon?

@staticfloat
Copy link

Julia does not support cross compilation of Julia code, the only reason it works the other way is because Apple built an emulator, Rosetta 2.

@mkitti
Copy link
Contributor Author

mkitti commented Jun 3, 2023

I think the closest tracking issue is JuliaLang/julia#30338

@ngam
Copy link
Contributor

ngam commented Jun 5, 2023

I see, yeah, this doesn’t look like a feature that will be resolved anytime soon (understandably so)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants