Skip to content

Instantly share code, notes, and snippets.

cmake_minimum_required(VERSION 3.10)
project(cppgen VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
link_libraries(pthread)
add_executable(cppgen cppgen.cc)
add_executable(cppgen-dup2 cppgen-dup2.cc)
add_executable(cppgen-lock cppgen-lock.cc)
with 0 points
with 160 points
with 60 points
with 140 points
with 64 points
with 52 points
with 84 points
with 146 points
with 52 points
with 76 points
#include "skel.h"
#include <torch/extension.h>
namespace py = pybind11;
PYBIND11_MODULE(skel, m) {
py::class_<Skel>(m, "Skel").def(py::init<>()).def("tensor", &Skel::tensor)
/**/
import timeit
import torch
from torch import nn
from torch.nn import functional as F
class Flags:
pass
import array
import os
import socket
import mmap
import time
def send_fds(sock, msg, fds): # not yet used
return sock.sendmsg(
// Copied from
// https://raw.githubusercontent.com/tensorflow/tensorflow/9590c4c32dd4346ea5c35673336f5912c6072bf2/tensorflow/core/platform/default/notification.h
// and slightly modified.
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
import os
import select
import sys
import termios
import gym
def play():
env = gym.make("AdventureNoFrameskip-v4" if len(sys.argv) < 2 else sys.argv[1])
import os
import sys
import tensorflow as tf
logdir = "/tmp/checkpoints"
def get_variables(logdir):
variables = {}
==50689== NVPROF is profiling process 50689, command: python simpleembed.py
==50689== Profiling application: python simpleembed.py
==50689== Profiling result:
Type Time(%) Time Calls Avg Min Max Name
GPU activities: 57.66% 248.18ms 30 8.2726ms 5.6467ms 13.019ms maxwell_scudnn_128x32_stridedB_splitK_interior_nn
16.02% 68.946ms 30 2.2982ms 1.0702ms 4.6368ms void calc_bias_diff<int=2, float, float, int=128, int=0>(cudnnTensorStruct, float const *, cudnnTensorStruct, float*, float, float, int)
4.22% 18.172ms 30 605.73us 2.6240us 945.47us _ZN2at6native18elementwise_kernelILi128ELi4EZNS0_15gpu_kernel_implIZNS0_16copy_kernel_implIffEEvRNS_14TensorIteratorEEUlfE_EEvS5_RKT_EUliE0_EEviT1_
3.22% 13.858ms 30 461.94us 100.42us 1.1248ms maxwell_scudnn_128x32_stridedB_small_nn
3.09% 13.316ms 30 443.88us 113.18us 1.0100ms maxwell_scudnn_128x32_r
FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y \
python3-setuptools \
python3-pip \
git \
libsm6 \
libxext6 \