Skip to content

Instantly share code, notes, and snippets.

View zarzen's full-sized avatar

Zhen Zhang zarzen

View GitHub Profile
@zarzen
zarzen / create_git_repo.org
Last active March 5, 2024 00:22
Create a Git repo base on windows shared folder

Reference

http://elegantcode.com/2011/06/18/git-on-windows-creating-a-network-shared-central-repository/

Step 1: Go to the remote shared folder

using `pushd` command

pushd \\remoteServer\git\Share\Folder\Path

Step 2: Create a folder to store repository


@zarzen
zarzen / spacemacs-cpp.md
Last active January 23, 2024 13:06
C++ development environment setup in Spacemacs
@zarzen
zarzen / ovs-example.md
Last active December 29, 2023 07:09
ovs example

install openvswitch 2.4

uninstall ovs-2.5

sudo apt autoremove  openvswitch-common openvswitch-switch-dpdk openvswitch-dbg openvswitch-pki openvswitch-ipsec openvswitch-switch openvswitch-switch-dpdk openvswitch-ipsec openvswitch-test openvswitch-testcontroller openvswitch-vtep

download source code

wget http://openvswitch.org/releases/openvswitch-2.4.0.tar.gz

unpack and compile

@zarzen
zarzen / nsight.sh
Created July 18, 2023 01:45 — forked from mcarilli/nsight.sh
Favorite nsight systems profiling commands for Pytorch scripts
# This isn't supposed to run as a bash script, i named it with ".sh" for syntax highlighting.
# https://developer.nvidia.com/nsight-systems
# https://docs.nvidia.com/nsight-systems/profiling/index.html
# My preferred nsys (command line executable used to create profiles) commands
#
# In your script, write
# torch.cuda.nvtx.range_push("region name")
# ...
@zarzen
zarzen / tmux.config
Created July 12, 2023 16:06
tmux config
set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on
unbind C-b
set -g prefix C-t
bind C-t send-prefix
# List of plugins
# this requires install tpm
@zarzen
zarzen / init.lua
Created June 30, 2023 05:56
nvim config
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }
vim.cmd [[packadd packer.nvim]]
end
require('packer').startup(function(use)
@zarzen
zarzen / bench_all_gather_coalescing.py
Last active October 21, 2022 04:20
all-gather with and without coalescing manager
"""
call to _all_gather_base with c10d._coalescing_manager
Test command:
mpirun -np $1 -N ${ndev_per_node} --hostfile ${HOST_FILE} \
--mca plm_rsh_no_tree_spawn 1 \
-mca btl tcp,self --mca btl_tcp_if_exclude lo,docker0 \
--mca pml ^cm \
-bind-to none \
--tag-output \
-x LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
@zarzen
zarzen / bandwidthTest.cu
Created October 7, 2020 17:13
PCIe bandwidth test
// CUDA runtime
#include <cuda_runtime.h>
#include <cuda.h>
#include <cassert>
#include <iostream>
#include <memory>
#include <thread>
#include <atomic>
diff --git a/csrc/lamb/fused_lamb_cuda_kernel.cu b/csrc/lamb/fused_lamb_cuda_kernel.cu
index e934b69c..207faa39 100644
--- a/csrc/lamb/fused_lamb_cuda_kernel.cu
+++ b/csrc/lamb/fused_lamb_cuda_kernel.cu
@@ -8,7 +8,7 @@
#include "ATen/cuda/CUDAContext.h"
#include "ATen/cuda/detail/IndexUtils.cuh"
//#include "ATen/Type.h"
-#include <THC/THCGeneral.h>
+// #include <THC/THCGeneral.h>
@zarzen
zarzen / ds-pt1.11.patch
Last active November 16, 2021 22:54
Ds-pt1.11.patch
diff --git a/csrc/lamb/fused_lamb_cuda_kernel.cu b/csrc/lamb/fused_lamb_cuda_kernel.cu
index 0448a45..ff87993 100644
--- a/csrc/lamb/fused_lamb_cuda_kernel.cu
+++ b/csrc/lamb/fused_lamb_cuda_kernel.cu
@@ -464,7 +464,7 @@ void fused_lamb_cuda(at::Tensor& p,
lamb_coeff.data<scalar_t>());
}));
}
- THCudaCheck(cudaGetLastError());
+ AT_CUDA_CHECK(cudaGetLastError());