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
The USB Blaster udev rules on the Altera website | |
( http://www.altera.com/download/drivers/dri-usb_b-lnx.html ) | |
did not work for me on Debian Jessie/Sid. A modified version of the file, listed below, works for me | |
(this is the contents of /etc/udev/rules.d/51-usbblaster.rules ). After restarting udev | |
(`sudo service udev restart`) I was able to program the DE0-Nano. | |
# USB-Blaster | |
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666", GROUP="plugdev" | |
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666", GROUP="plugdev" | |
SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666", GROUP="plugdev" |
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 a new class | |
class Interval(object): | |
'''A half-open interval on the real number line.''' | |
def __init__(self, lo, hi): | |
self.lo = lo | |
self.hi = hi | |
def __repr__(self): | |
return 'Interval(%f, %f)' % (self.lo, self.hi) |
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
from numba import vectorize | |
import numpy as np | |
@vectorize(['uint(c8, c8, uint)']) | |
def calculate_z(qi, zi, maxiter): | |
output = 0.0 | |
for iteration in range(maxiter): | |
zi = zi * zi + qi | |
if abs(zi) > 2.0: | |
output = iteration |
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
from numba import njit | |
import numpy as np | |
@njit | |
def calculate_z(q, z, output, maxiter): | |
#"""Pure python with complex datatype, iterating over list of q and z""" | |
for i in range(len(q)): | |
zi = z[i] | |
qi = q[i] | |
for iteration in range(maxiter): |
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
From 6db58ab934b7210787f5bd7ad92f7050f43edcb3 Mon Sep 17 00:00:00 2001 | |
From: Graham Markall <[email protected]> | |
Date: Wed, 14 Jan 2015 11:10:28 +0000 | |
Subject: [PATCH 1/2] Add debug and lineinfo options | |
--- | |
matrixMulDynlinkJIT.cpp | 12 +++++++++++- | |
1 file changed, 11 insertions(+), 1 deletion(-) | |
diff --git a/matrixMulDynlinkJIT.cpp b/matrixMulDynlinkJIT.cpp |
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
from numba import cuda | |
gpus = cuda.gpus.lst | |
for gpu in gpus: | |
with gpu: | |
meminfo = cuda.current_context().get_memory_info() | |
print("%s, free: %s bytes, total, %s bytes" % (gpu, meminfo[0], meminfo[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
from __future__ import print_function | |
from mpi4py import MPI | |
from numba import cuda | |
import numpy as np | |
mpi_comm = MPI.COMM_WORLD | |
# Input data size | |
total_n = 10 |
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 numba import njit | |
@njit | |
def f(arr1, arr2): | |
for i in range(len(arr1)): | |
arr1[i] += arr2[i] | |
a = np.arange(10) | |
b = np.arange(10) |
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
# Based on http://mah.everybody.org/docs/ssh | |
# set environment variables if user's agent already exists | |
[ -z "$SSH_AUTH_SOCK" ] && SSH_AUTH_SOCK=$(ls -l /tmp/ssh-*/agent.* 2> /dev/null | grep $(whoami) | awk '{print $9}') | |
[ -z "$SSH_AGENT_PID" -a "$SSH_AUTH_SOCK" ] && [ -n `echo $SSH_AUTH_SOCK | cut -d. -f2` ] && SSH_AGENT_PID=$((`echo $SSH_AUTH_SOCK | cut -d. -f2` + 1)) | |
[ -n "$SSH_AUTH_SOCK" ] && export SSH_AUTH_SOCK | |
[ -n "$SSH_AGENT_PID" ] && export SSH_AGENT_PID | |
# start agent if necessary | |
if [ -z $SSH_AGENT_PID ] && [ -z $SSH_TTY ]; then # if no agent & not in ssh |
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 hashlib | |
d = {} | |
for i in range(1200000): | |
k = hashlib.md5('%x' % i).digest() | |
d[k] = i | |
#for k in d.keys(): | |
# print k |