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
std::vector<std::thread> workers; | |
std::atomic<unsigned int> i(0); | |
for (auto t = 0; t < std::thread::hardware_concurrency(); t++){ | |
workers.push_back(std::thread([&,t](){ | |
int index = 0; | |
while((index = i++) < numItems){ | |
... | |
} | |
})); |
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
// Simple Bilinear interpolation(e.g. texture filtering) | |
// w0 + w1 + w2 + w3 = 1.0f; | |
// a[0] ~ a[3] = alpha value of 2x2 pixels. | |
float ret = w0 * a[0] + w1 * a[1] + w2 * a[2] + w3 * a[3]; | |
// Sometimes ret become 0x3ffffff if all a's are 1.0f(0x3f800000) due to numerical error? |
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
// atan2(y, x) = | |
// | |
// y y | |
// pi/2|\ pi/2|\ | |
// | | | |
// pi | 0 pi | 0 | |
// ---------o---------> x =>> ---------o--------> x | |
// -pi | -0 pi | 2 pi | |
// | | | |
// | | |
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
# config.toml | |
baseurl = "" | |
languageCode = "en-us" | |
title = "Fah doc" | |
relativeURLs = true | |
uglyURLs = true |
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
gcloud compute instances create ${GCE_MASTER_INSTANCE_NAME} ... | |
# wait instance boot up | |
# fixme: there should be much better way | |
sleep 30 | |
# shutdown after 60 min | |
# must add -f flag(background execution) | |
gcloud compute ssh ${GCE_MASTER_INSTANCE_NAME} --zone ${GCE_ZONE} --ssh-flag="-f" --command="sudo /sbin/shutdown -h -P +60" |
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
$ cat test.n | |
(none | |
; This top-level code is dynamic and compiled to Lua code | |
(function printhello () | |
; all statements are symbolic expressions | |
; known from Lisp and Scheme | |
(print "None is as dynamic as this!")) | |
(static mymul(a b) |
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 <arm_neon.h> | |
typedef float float4 __attribute__((ext_vector_type(4))); | |
float4 mymax(float4 a, float4 b) | |
{ | |
float4 ret; | |
ret = vmaxq_f32(a, b); | |
return ret; |
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
// | |
// SPARC HPC-ACE | |
// FCCpx -Krestp=all -Kfast expf_test.cpp | |
// | |
fmath_exp aveDiff= 1e-06 maxDiff=3.891789e-06 | |
new_exp aveDiff= 2e-08 maxDiff=1.192089e-07 | |
new_exp4 aveDiff= 2e-08 maxDiff=1.192078e-07 | |
new_exp4d aveDiff= 2e-08 maxDiff=5.036628e-08 | |
std::exp 0.197360 | |
fmath_exp 0.110120 |
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
//// new_exp | |
// == sim start == | |
LLFB4 | |
L32 | |
LSSN114 | |
L33 | |
LSSN115 | |
00000001 : ld %f0 | |
LSSN116 |
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
00000610 <_new_exp>: | |
610: 200b 0002 mov r1,0x0 | |
614: 200b 13c2 movt r1,0x3c00 | |
618: 59ab 0cc2 mov r2,0xcccd | |
61c: 00a7 fmul r0,r0,r1 | |
61e: 712b 0882 mov r3,0x8889 | |
622: 610b 13d2 movt r3,0x3d08 | |
626: 498b 13e2 movt r2,0x3e4c | |
62a: 200b 0002 mov r1,0x0 | |
62e: 300b 13f2 movt r1,0x3f80 |