This guide is a summation of current situation as of Apr. 26, 2020, on how to build and use native Aarch64 (ARM64) Visual Studio Code on devices like Surface Pro X.
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
#!/bin/bash | |
TEXMACSAPP=/Applications/TeXmacs-1.99.11.app | |
MATHPLAYERAPP=/Applications/Wolfram\ Engine.app/Contents/Resources/Wolfram\ Player.app | |
MLINKROOT=$MATHPLAYERAPP/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions | |
clang -m64 -o ~/.TeXmacs/bin/tm_mathematica.bin \ | |
$TEXMACSAPP/Contents/Resources/share/TeXmacs/plugins/mathematica/src.lazy/tm_mathematica.c \ | |
-I "$MLINKROOT" -L "$MLINKROOT" -lMLi4 -lm -lpthread -lstdc++ -ldl -luuid -framework CoreFoundation | |
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
#!/bin/bash | |
# 1. Installation location of the Wolfram Engine | |
WOLFRAMROOT=/usr/local/Wolfram/WolframEngine/12.1 | |
# 2. MathLink path. Consider saving it for reasons in 4. | |
MLINKROOT=$WOLFRAMROOT/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions | |
# 3. Compile | |
gcc -m64 -o ~/.TeXmacs/bin/tm_mathematica.bin \ | |
/usr/share/TeXmacs/plugins/mathematica/src.lazy/tm_mathematica.c \ |
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
""" | |
Tensordot.jl - Minimal Tensordot Implementation | |
Minimal tensordot for supporting Zygote's automatic differentiation. | |
This bunch of code is also compatible with FluxML's Tracker module. | |
""" | |
module Tensordot | |
using Zygote: @adjoint | |
using LinearAlgebra |
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
#include <iostream> | |
#include <blis/blis.h> | |
#include <boost/numeric/ublas/matrix.hpp> | |
#include <boost/numeric/ublas/io.hpp> | |
int main(const int argc, const char *argv[]) | |
{ | |
// these two doesn't conflict. | |
using namespace std; | |
using namespace boost::numeric::ublas; |
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
# here idx has 3 entries corresponding to e.g. "ik,jk->ij". | |
contract!(A::Array{T}, | |
B::Array{T}, | |
C::Array{T}, | |
idx) where {T<:Dual} = contract!(T, sizeof(T)/sizeof(tovalue(T)), # tovalue unveils base type. | |
A, 0, B, 0, C, 0, idx) | |
contract!(Type::Dual{Tg, T, ND}, topst, # top-level stride | |
A::Array, sftA, # arrays here are all at their top-level (not dispatched) | |
B::Array, sftB, |
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
module BatchDef | |
macro def_numed_fun(funname, num) | |
numed_funname = Symbol(string(funname, num)) | |
@show numed_funname | |
return quote | |
$(esc(numed_funname))() = $num | |
end | |
end |
What
Compile NumPy on Apple Silicon M1 Chip
How
- Create virtual env at, say
export VENV=$HOME/.local
:
python3 -m venv $VENV
. $VENV/bin/activate
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
import Foundation | |
import MLCompute | |
import PlaygroundSupport | |
let iPage = PlaygroundPage.current | |
iPage.needsIndefiniteExecution = true | |
/* | |
* Apple says MLCMatMulLayer does a ``batch matrix multiplication'' | |
* but didn't make clear its meaning. |
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 Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
*/ | |
#pragma once | |
#include <complex> | |
#include <algorithm> | |
// Real softplus. |