Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dwf's full-sized avatar

David Warde-Farley dwf

View GitHub Profile
@dwf
dwf / gist:f071422e3d3e09a4024a70c649b7cd51
Created April 8, 2024 21:30
Error log from attempted jax-rocm build
Python 3.11.8 (main, Feb 6 2024, 21:21:21) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jax
2024-04-08 22:23:25.127712: E external/xla/xla/stream_executor/plugin_registry.cc:91] Invalid plugin kind specified: DNN
>>> X = jax.numpy.zeros((5000, 6000))
:1:hip_code_object.cpp :516 : 809713991079 us: [pid:3362424 tid:0x7ffff7eaf740] hipErrorNoBinaryForGpu: Unable to find code object for all current devices!
:1:hip_code_object.cpp :517 : 809713991085 us: [pid:3362424 tid:0x7ffff7eaf740] Devices:
:1:hip_code_object.cpp :520 : 809713991086 us: [pid:3362424 tid:0x7ffff7eaf740] amdgcn-amd-amdhsa--gfx1100 - [Not Found]
:1:hip_code_object.cpp :524 : 809713991091 us: [pid:3362424 tid:0x7ffff7eaf740] Bundled Code Objects:
:1:hip_code_object.cpp :540 : 809713991092 us: [pid:3362424 tid:0x7ffff7eaf740] host-x86_64-unknown-linux-- - [Unsupported]
@dwf
dwf / gist:1222883
Created September 16, 2011 19:19
Using matplotlib + multiprocessing for asynchronous, interactive monitoring plots.
"""Demo of how to pop up plots asynchronously using separate processes."""
from multiprocessing import Process
import time
import sys
import matplotlib.pyplot as plt
import numpy as np
def demo():
i = 0
processes = []
@dwf
dwf / flake.nix
Created January 2, 2024 00:33
Minimal example of YAML as flake output
# Copyright 2024 Google LLC.
# SPDX-License-Identifier: Apache-2.0
{
description = "Demo of generating a YAML file as a flake output";
outputs = { self, nixpkgs }: let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
@dwf
dwf / gist:300966
Created February 10, 2010 23:19
Some string tokenization example code in C, written for a systems programming tutorial.
/* Demonstrates breaking up a string in much the same manner as is done by
* the standard library function strtok. It's also an actually practical
* occurrence of a triple pointer (char ***).
*
* Prepared for tutorial purposes by David Warde-Farley, CSC209H Winter 2008
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@dwf
dwf / gist:1335246
Created November 2, 2011 23:10
My implementation of feature sign search for L1 minimization.
"""
L1-penalized minimization using the feature sign search algorithm.
"""
import logging
import numpy as np
log = logging.getLogger("feature_sign")
log.setLevel(logging.INFO)
@dwf
dwf / msnlog.py
Created February 1, 2010 21:04
A script that dumps convoluted XML log files from MSN Messenger to readable plaintext.
"""
Simple script I whipped up to dump MSN Messenger logs in XML to a readable
plaintext format. It's not very robust, nor am I sure which versions of MSN
Messenger it's compatible or incompatible with; I just had a specific
conversation I wanted to read, and this was the vehicle to that end.
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf)
Redistributable under the terms of the 3-clause BSD license
(see http://www.opensource.org/licenses/bsd-license.php for details)
@dwf
dwf / patches.py
Created April 14, 2010 19:49
Some patch extraction code I'm using to process images.
import os
import numpy as np
import scipy.ndimage as ndimage
import matplotlib
import matplotlib.pyplot as plt
def frac_eq_to(image, value=0):
return (image == value).sum() / float(np.prod(image.shape))
def extract_patches(image, patchshape, overlap_allowed=0.5, cropvalue=None,
@dwf
dwf / flash-nanocul-evofw3.mk
Created March 21, 2022 23:14
Makefile for flashing a nanoCUL stick with the latest version of the evofw3 firmware.
# Copyright 2022 Google LLC.
# SPDX-License-Identifier: Apache-2.0
#
# Makefile for flashing a nanoCUL stick with evofw3 using arduino-cli.
#
# Get arduino-cli and make with `nix shell nixpkgs#gnumake nixpkgs#arduino-cli`.
# Then run make -f flash-nanocul.mk.
# One of atmega328p, atmega32u4. Only tested with atmega328p, the one I have.
BOARD=atmega328p
@dwf
dwf / gist:1766222
Created February 8, 2012 06:55
Example of how to read a partial NumPy array stored in NPY format off of disk.
"""
Example of how to read a partial NumPy array stored in NPY
format off of disk.
"""
__author__ = "David Warde-Farley"
__copyright__ = "Copyright (c) 2012 by " + __author__
__license__ = "3-clause BSD"
__email__ = "dwf@dwf.name"
import struct
@dwf
dwf / resize_videos.py
Created November 29, 2011 19:41
A batch video-resizing script.
#!/usr/bin/env python
# Copyright (c) 2009, David Warde-Farley
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.