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 numpy as np | |
from udmabuf import Udmabuf | |
from uio import Uio | |
import os | |
import struct | |
import math | |
# set path to the BNN-PYQN repo. | |
BNN_PYNQ_ROOT = '.' | |
PARAM = 'bnn/params/mnist' |
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
+ def config_sync(self, size, direc): | |
+ with open(self.class_path + '/sync_size', mode='w') as f: | |
+ f.write(str(size)) | |
+ with open(self.class_path + '/sync_direction', mode='w') as f: | |
+ f.write(str(direc)) | |
+ | |
+ def sync_for_cpu(self): | |
+ with open(self.class_path + '/sync_for_cpu', mode='w') as f: | |
+ f.write(str(1)) | |
+ |
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
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.std_logic_unsigned.all; | |
entity pipeline_top is | |
port ( | |
xi : in std_logic_vector(31 downto 0); | |
yi : in std_logic_vector(31 downto 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
/VARI xi, yi, zi, e2; | |
/VARJ xj, yj, zj, mj; | |
/VARF ax, ay, az, ap; | |
dx = xj - xi; | |
dy = yj - yi; | |
dz = zj - zi; | |
r2 = dx*dx + dy*dy + dz*dz + e2; | |
r1i = powm12(r2); | |
r2i = r1i*r1i; | |
r1im = mj*r1i; |
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
/VARI xi, yi, zi, vxi, vyi, vzi, hi; | |
/VARJ xj, yj, zj, vxj, vyj, vzj, hj, mj; | |
/VARF rho, rox, roy, roz, dd; | |
dx = xi - xj; | |
dy = yi - yj; | |
dz = zi - zj; | |
r2 = dx*dx + dy*dy + dz*dz; | |
r1 = sqrt(r2); |
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
// A B C D E F G H I J K M | |
// 0 1 2 3 4 5 6 7 8 9 10 11 | |
struct HKeys { | |
static const uint64 T0[12][8]; | |
static const uint64 T1[12][8]; | |
uint64 poi(uint64 key, uint64 level) | |
{ | |
return (key >> 3*level)&0x7ULL; | |
} |
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
.file "/tmp/5d41e25b-e85e-4f10-836a-5b23eab3f6a7.TMP" | |
.text | |
.globl _Z12native_rsqrtDv8_f | |
.align 16, 0x90 | |
.type _Z12native_rsqrtDv8_f,@function | |
_Z12native_rsqrtDv8_f: # @_Z12native_rsqrtDv8_f | |
# BB#0: | |
vrsqrtps YMM0, YMM0 | |
ret | |
.Ltmp0: |
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
def self.get(url) | |
return self.new(Open3.popen3("curl", "--location", "--compressed", url) {|i,o,e| o.read }) | |
end |
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
#define READONLY_P const * restrict | |
float4 sum(float8 x) | |
{ | |
float4 tmp; | |
tmp.x = x.s0 + x.s4; | |
tmp.y = x.s1 + x.s5; | |
tmp.z = x.s2 + x.s6; | |
tmp.w = x.s3 + x.s7; | |
return tmp; |
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
#define READONLY_P const * restrict | |
__kernel | |
void | |
grav1( | |
__global float4 READONLY_P x, | |
__global float4 READONLY_P y, | |
__global float4 READONLY_P z, | |
__global float4 READONLY_P m, | |
__global float4 *ax, |