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 pyximport | |
import numpy as np | |
pyximport.install(setup_args={'include_dirs': np.get_include()}) |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
// Approximation for EXP(x), only valid for -126.0f < x < 0.0f. | |
static inline __m256 _mm256_expfast_ps(const __m256 &q) { | |
const __m256 INVLOG_2 = _mm256_set1_ps(1.442695040f); | |
const __m256 BIT_SHIFT = _mm256_set1_ps(8388608); | |
const __m256 ONE = _mm256_set1_ps(1.0f); | |
const __m256 C1 = _mm256_set1_ps(121.2740838f); | |
const __m256 C2 = _mm256_set1_ps(27.7280233f); | |
const __m256 C3 = _mm256_set1_ps(4.84252568f); |
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
// Approximation for EXP(x) -- very fast, but not super accurate | |
static inline __m256 _mm256_expfaster_ps(const __m256 &q) { | |
const __m256 C1 = _mm256_set1_ps(1064872507.1541044f); | |
const __m256 C2 = _mm256_set1_ps(12102203.161561485f); | |
return _mm256_castsi256_ps(_mm256_cvttps_epi32(_mm256_fmadd_ps(C2, q, C1))); | |
} |
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
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
7 | |
2 | |
1 | |
0 | |
4 | |
1 | |
4 | |
9 | |
5 | |
9 |
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 asyncio | |
from concurrent import futures | |
import functools | |
import inspect | |
import threading | |
from grpc import _server | |
def _loop_mgr(loop: asyncio.AbstractEventLoop): |