This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/usr/bin/env python3 | |
import torch | |
from torch import distributed as dist | |
dist.init_process_group(backend="nccl") | |
torch.cuda.set_device(f"cuda:{dist.get_rank()}") | |
if dist.get_rank() == 0: | |
print("I am rank 0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://github.com/vpenso/ganglia-sensors/blob/master/lib/python_modules/infiniband.py#/ | |
import logging | |
import re | |
import sys | |
import json | |
import time | |
import subprocess | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define NUM_STREAMS 4 | |
cudaError_t memcpyUsingStreams (float *fDest, | |
float *fSrc, | |
int iBytes, | |
cudaMemcpyKind eDirection) | |
{ | |
cudaStream_t *pCuStream = NULL; | |
int iIndex = 0 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
clang_format=clang-format | |
autopep=autopep8 | |
for FILE in $(git diff --cached --name-only) | |
do | |
if [[ $FILE == *.py ]]; then | |
if ! command -v $autopep &> /dev/null; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// t.h | |
#include <iostream> | |
using namespace std; | |
template <typename T1, typename T2> | |
class A { | |
public: | |
void foo(); | |
}; |