Skip to content

Instantly share code, notes, and snippets.

View jackalcooper's full-sized avatar

Shenghang Tsai jackalcooper

View GitHub Profile
@banach-space
banach-space / matmul.mlir
Last active June 3, 2024 07:11
C += A*B
// The following matmul maps very nicely onto SME with SVL=128bits. For f32, there are 4 4x4 tiles,
// that can be assembled as a 8x8 matrix.
// %mat_A_tr - transpose of A
func.func @matmul(%mat_A_tr: memref<6x8xf32>, %mat_B: memref<6x8xf32>, %mat_C: memref<8x8xf32>) {
linalg.matmul ins(%mat_A_tr, %mat_B: memref<6x8xf32>, memref<6x8xf32>)
outs(%mat_C: memref<8x8xf32>)
return
}
@caspg
caspg / 1_searchbar_live.ex
Last active November 6, 2024 11:04
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end
@shingohry
shingohry / ViewController.swift
Created June 11, 2019 17:13
NetworkingWithCombine
import UIKit
import Combine
/*
# References
- [ra1028/SwiftUI-Combine: This is an example project of SwiftUI and Combine using GitHub API.](https://github.com/ra1028/SwiftUI-Combine)
- [marty-suzuki/GitHubSearchWithSwiftUI: SwiftUI and Combine based GitHubSearch example.](https://github.com/marty-suzuki/GitHubSearchWithSwiftUI)
- [DataTaskPublisherを作ってみた](https://gist.github.com/yamoridon/16c1cc70ac46e50def4ca6695ceff772)
- [【iOS】Combineフレームワークまとめ(2019/6/9時点) - Qiita](https://qiita.com/shiz/items/5efac86479db77a52ccc)
*/
@alexito4
alexito4 / RemoteImage.swift
Last active August 19, 2020 15:32
Rough sketch of SwiftUI RemoteImage using AlamofireImage
import SwiftUI
import Combine
import AlamofireImage
let imageDownloader = ImageDownloader(
configuration: ImageDownloader.defaultURLSessionConfiguration(),
downloadPrioritization: .fifo,
maximumActiveDownloads: 4,
imageCache: AutoPurgingImageCache()
)
@mjambon
mjambon / parallel
Last active March 28, 2024 11:09
bash: Run parallel commands and fail if any of them fails
#! /usr/bin/env bash
#
# Run parallel commands and fail if any of them fails.
#
set -eu
pids=()
for x in 1 2 3; do
@TomFaulkner
TomFaulkner / ubuntu18.04-vfio.md
Last active February 3, 2024 15:28
VFIO Setup on Ubuntu 18.04
@gangliao
gangliao / plot_bench_1.py
Last active May 24, 2024 10:53
Horovod with TCP and IB
import matplotlib.pyplot as plt
#for plotting
import numpy as np
# create plot
fig, ax = plt.subplots()
bar_width = 0.15
opacity = 0.8
xlabel= np.array([8, 16, 32, 64])
@peterroelants
peterroelants / mnist_new_dataset_hook.py
Created August 8, 2017 08:32
Tensorflow Dataset API initialiser hook fix
from __future__ import division, print_function, absolute_import, \
unicode_literals
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
from tensorflow.contrib.learn.python.learn import learn_runner
@multiplemonomials
multiplemonomials / FindMKL.cmake
Last active May 6, 2021 23:03
CMake script to find MKL. A MKL Link Line Advisor in your pocket! (Does not work on Windows, yet) Heavily modified from the original (by hanjianwei), and battle tested across many different distros and computers, including the SDSC supercomputer Comet. Requires my other CMake gists, LibraryUtils.cmake and CheckLinkerFlag.cmake.
# - Find Intel MKL
# modified for AMBER
# Find the MKL libraries
#
# NOTE: MKL_MULTI_THREADED requires the patched FindOpenMPFixed module from the Amber-MD/cmake-buildscripts repository.
#
# Options:
#
# MKL_STATIC : use static linking. Requires linker support for the -Wl,--start-group flag.
# MKL_MULTI_THREADED: use multi-threading. Requires the FindOpenMP module
@rafaspadilha
rafaspadilha / customLayerTutorial.md
Last active August 12, 2022 03:28
Caffe Python Layer

How to create a custom Caffe layer in Python?

This tutorial will guide through the steps to create a simple custom layer for Caffe using python. By the end of it, there are some examples of custom layers.

- Why would I want to do that?

Usually you would create a custom layer to implement a funcionality that isn't available in Caffe, tuning it for your requirements.

- What will I need?

Probably just Python and Caffe installed.

- Is there any downside?