Skip to content

Instantly share code, notes, and snippets.

@beaulian
beaulian / cuda_installation_on_ubuntu_18.04
Created July 18, 2019 05:43 — forked from Brainiarc7/cuda_installation_on_ubuntu_18.04
cuda 9.0 installation guidline for ubuntu 18.04 LTS
# first get the PPA repository driver
sudo add-apt-repository ppa:graphics-drivers/ppa
# install nvidai driver
sudo apt install nvidia-384 nvidia-384-dev
# install other import packages
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
# CUDA 9 requires gcc 6
@beaulian
beaulian / CMakeLists.txt
Created July 5, 2019 03:49 — forked from erikzenker/CMakeLists.txt
CMake CUDA + C++ in separate files
# CMAKE FILE to separatly compile cuda and c++ files
# with the c++11 standard
#
#
# Folder structure:
#
# |
# +--main.cpp (with C++11 content)
# +--include/
# | |
# Import needed packages
import torch
import torch.nn as nn
from torchvision.transforms import transforms
import matplotlib.pyplot as plt
import numpy as np
from torch.autograd import Variable
from torchvision.models import squeezenet1_1
import torch.functional as F
import requests
#coding=utf-8
import sys
import json
import time
import random
import requests
import platform
import traceback
import subprocess
@beaulian
beaulian / cuda_string.h
Last active August 1, 2018 03:46
The implement of c string library for CUDA
#ifndef CUDA_STRING_H
#define CUDA_STRING_H
/* Provide an uniform cuda string library.
All following functions can be found by internet.
*/
__device__ bool c_strcmp(const char *a, const char *b, unsigned l) {
for (int i = 0; i< l; i++)
if (a[i] != b[i]) return false;
@beaulian
beaulian / machine_learned_index.py
Created April 28, 2018 02:23 — forked from tokestermw/machine_learned_index.py
Using deep learning to approximate a B-Tree index from this paper: https://arxiv.org/abs/1712.01208 (The Case for Learned Index Structures)
import click
import torch
import torch.autograd
import torch.nn.functional as F
from torch.autograd import Variable
import os
import random
import math