Skip to content

Instantly share code, notes, and snippets.

View austin362667's full-sized avatar

Austin Liu austin362667

View GitHub Profile
@austin362667
austin362667 / rust-cross-build.md
Last active November 5, 2022 17:53
Rust Cross Compile

cross build 首先你要有支援 target platform 的 cross compiler,再來透過 rustup 下載對應的 component,最後用 cargo build --target 指定平台

https://github.com/cross-rs/cross 以外有其它的簡單方式嗎?

cross 我記得也是開 docker container 去編譯的

最方便的交叉編譯 就是去 target platform 。 我認同, 最合適的工具其實就是 github actions.

另外 Gitpod 也可以考慮,編譯很快

@austin362667
austin362667 / MC.md
Last active November 2, 2022 11:10
How Monte Carlo simulation applied in finance

蒙地卡羅法

利用亂數隨機抽樣的方式以計算某種解答的演算法,被稱為蒙地卡羅演算法,其中最簡單的方法是直接取樣算法。

Pi

舉例而言,假如我們不知道半徑為 1 的圓形面積,那麼就可以利用亂數隨機取樣 1 百萬個 X=random[-1…1], Y=random[-1…1] 之間的的值,然後看看有多少點落在 x^2+y^2<=1 的範圍之內 P(in circle)。最後利用 4 * P(in circle) 就可以計算出該圓形的面積。

我猜大家第一次聽到 Monte Carlo Methods 的地方大概就是上述估計 pi 這個 toy problem,裡面利用的是 Monte Carlo Integration 的概念。Monte Carlo Methods 是一系列利用 randomness 求解 deterministic models 的方法,基於大數法則能在期望值上得到正確解。

Path tracing

@austin362667
austin362667 / SimilarMatrix.md
Created November 15, 2022 10:19
The Nullity Between Similar Matrices

因為,

$$ B = P^{-1} A P $$

可得,

$$ P B = A P

@austin362667
austin362667 / CS.md
Last active November 27, 2022 09:45
[Synchronization] Critical-Section Problem

C.S. 問題三要素

  1. Mutual Exclusion
    • 一次只有一人能吃飯
  2. Progress
    • 沒人吃飯時, 我想吃飯一定吃得到飯
    • No influence: 我不吃飯時不能影響別人是否能吃到飯
    • Deadlock-freedom: 一定有人吃得到飯
  3. Bounded Waiting
    • 總會輪到我吃飯, 排隊等待時間必有 bound
@austin362667
austin362667 / log.md
Last active December 5, 2022 12:51
RISC-V Hello World

先給 OpenGPT 閱讀了以下有關 RISC-V 的教學文章:

在本系列的文章中,我們將介紹如何建構一個 RISC-V 處理器上的嵌入式作業系統,該作業系統名稱為 mini-arm-os 。(其實是一系列的程式,非單一系統)

首先在本章中,我們將介紹一個最簡單可以印出 Hello OS! 的程式該怎麼寫!

os.c
https://github.com/cccriscv/mini-riscv-os/blob/master/01-HelloOs/os.c
@austin362667
austin362667 / log.md
Last active December 5, 2022 13:58
Stochastic Volatility Models

關於隨機波動理論


Austin : 一般來說,我們可能會考慮市場價格由趨勢和波動組成,其中波動的幅度對應發生的機率是固定的,這就是我們所謂的波動率為常數的概念。

Machine : 是的,波動率是指市場價格在一段時間內波動的幅度。如果波動率為常數,則代表每次波動的幅度相同,並且波動的頻率也是固定的。這種情況下,我們可以用數學模型來預測市場價格的變化情況。


@austin362667
austin362667 / roofline.md
Last active February 13, 2023 06:32
Roofline model
@austin362667
austin362667 / NTU_106_HW_Q1.md
Last active December 9, 2022 08:03
ILP Benchmarking + Cache

截圖 2022-12-09 上午9 14 24

5-Stage Pipelined MIPS CPU,
L1:
  I-Cache: 256KB, D-Cache: 32KB
MEM Latency: 200ps(raiesd up to 250ps),
Base CPI(ideal cache) = 1,
Miss Penalty 200 cycles, I-Cache Miss Rate: 5%, D-Cache Miss Rate: 10%(reduce down to 5%).
@austin362667
austin362667 / transformer.md
Last active December 13, 2022 10:16
Transoformer QA

Large-Scale Pretraining with Transformers

更 high level 來看, BERT 是用了 Transformer 的 encoder; GPT 則是用了 Transformer 的 decoder.

  1. 注意力機制中 Q, K, V 意義上是什麼, 是如何產生的?

    想像一個場景:一張白色的桌子上有一張白色的紙和一顆紅色的蘋果.

    這時, Values 就是整個場景. Keys 就是你不經意就會注意到的明顯物體(e.g., 紅色蘋果).

@austin362667
austin362667 / discussion.md
Last active December 14, 2022 11:21
random discussion on Processor Performance(critical path & regs size) & Pipelining

Processor Performance

The critical path latencies for the 7 major blocks in a simple processor are given below.

CPU IMem Add Mux ALU Regs DMem Control
a 400ps 100ps 30ps 120ps 200ps 350ps 100ps
b 500ps 150ps 100ps 180ps 220ps 1000ps 65ps

For each part, answer the following questions: