Skip to content

Instantly share code, notes, and snippets.

View SomeoneSerge's full-sized avatar
💭
Completely swamped again

Someone SomeoneSerge

💭
Completely swamped again
View GitHub Profile
#! /usr/bin/env nix-shell
#! nix-shell -i python -p "(import ./. { config = { allowUnfree = true; cudaSupport = true; }; }).python3.withPackages (ps: with ps; [ pytorch ])"
import torch
a = torch.randn(1, 3, 128, 128, device="cuda")
torch.nn.functional.conv2d(a, torch.randn(1, 3, 2, 2, device="cuda"))
print("ok")
{ lib, config, pkgs, ... }:
let
ldconfig = pkgs.writeScript "ldconfig" ''
#! /usr/bin/env bash
cleanup() {
rm -f "$TMP"
}
trap cleanup EXIT
@SomeoneSerge
SomeoneSerge / Dockerfile
Created June 9, 2021 18:04
Nix with Flakes support on top of ubuntu:20.04 docker
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get --yes install curl xz-utils sudo \
&& apt-get clean && rm -rf /var/lib/apt/lists/ \
&& useradd -m -G sudo --password "!" --shell /bin/bash my-user \
&& (echo 'my-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers)
@SomeoneSerge
SomeoneSerge / check_par.py
Last active June 4, 2021 10:16
An attempt to evaluate multiple pytorch models in parallel on a single GPU without threading or mpi
import itertools
from copy import deepcopy
from functools import partial
from itertools import cycle
from pprint import pprint
from timeit import timeit
from typing import List, Tuple
import numpy as np
import pandas as pd
cc_library(
name="downstream",
srcs=[
# ...
],
hdrs=[
# ...
],
deps=[
"@eigen//:eigen",
@SomeoneSerge
SomeoneSerge / BUILD.downstream.bzl
Last active May 17, 2021 11:14
Eigen, SuiteSparse and sparseLM in Bazel
cc_library(
name="doctest",
hdrs=["@doctest//file"],
visibility=["//visibility:public"],
strip_include_prefix = "/external/doctest/file",
include_prefix = "doctest",
)
cc_library(
name="downstream",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import torch
from functools import partial
from dataclasses import dataclass, astuple, asdict
from typing import List, Optional, Tuple, Union
from warnings import warn
from .numutils import unit
from .torch_fix import (
Matrices3x4,
Matrices4x4,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.