Skip to content

Instantly share code, notes, and snippets.

@MerHS
MerHS / multi_p2p.py
Created June 27, 2024 08:56
P2P communication test
##### fig 1.
##### nsys profile -w true -t cuda,nvtx,osrt,cudnn,cublas -s cpu --cudabacktrace=true -x true -f true -o fig1 torchrun --nproc_per_node 3 run.py --devs 0 2 3
import os
import time
import torch
import torch.distributed as dist
from threading import Thread
from torch.profiler import ProfilerActivity, profile
@MerHS
MerHS / gist:5186236e97de6c8419a71559f0b08847
Created June 4, 2021 06:14
xiong-chiamiov-plus.zsh-theme (with conda env)
# user, host, full path, and time/date
# on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
# conda config --set changeps1 False
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[$CONDA_DEFAULT_ENV] <$(git_prompt_info)>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
@MerHS
MerHS / test.md
Last active September 4, 2020 01:55
python/torch 3

python 스크립트 내리기

  1. function default parameter
def f(a, b=3):
  return a + b
  
f(a)
@MerHS
MerHS / test.md
Created August 28, 2020 06:47
TorchIR test
import torch
import argparse
from torch import nn
from torch.nn import LSTM

parser = argparse.ArgumentParser(description="Python tensor type resolver / example 1")

parser.add_argument("--len", type=int, default=5, help="length of sequence")
@MerHS
MerHS / README.md
Last active August 16, 2019 01:46
Tag2pix readme

Tag2Pix: Line Art Colorization Using Text Tag With SECat and Changing Loss

test image

This repository is the official PyTorch implementation of Tag2Pix

Prerequisite

  • pytorch >= 1.0.1
  • torchvision >= 0.2.2
  • numpy/scipy
@MerHS
MerHS / sine.jl
Created July 24, 2019 13:04
Physlab 2-5
##
using QuadGK
using Calculus
##
D = 0.39
H = 0.42
W = 0.63
r_max = 0.06
N = 300
@MerHS
MerHS / square.jl
Created July 24, 2019 02:22
magnetic field of square solenoid
i_square = 1.0
n_square = 30
h = 0.102
H = 0.178
W = 0.178
coeff = i_square * n_square * 10^-7
function B1(x, y)
r = sqrt(x^2 + y^2)
dl = H / 500