This file contains hidden or 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
| import torch | |
| from torch import nn | |
| from torch.nn import functional as F | |
| from torchvision import transforms | |
| import pytorch_lightning as pl | |
| class Block(nn.Module): | |
| def __init__(self, in_ch, out_ch): | |
| super().__init__() |
This file contains hidden or 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
| package allocs | |
| import ( | |
| "context" | |
| "testing" | |
| "time" | |
| "github.com/go-redis/redis/v9" // v9-rc2 | |
| "github.com/rueian/rueidis" // v0.0.90 | |
| ) |
This file contains hidden or 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
| import ray | |
| import time | |
| from dataclasses import dataclass | |
| from heapq import heappush, heappop | |
| @dataclass | |
| class Meta: | |
| max: int | |
| rtt: float = 10 | |
| size: int = 1 |
This file contains hidden or 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
| # syntax=docker/dockerfile:experimental | |
| FROM nvidia/cuda:11.4.0-cudnn8-devel-ubuntu20.04 | |
| ENV PATH /usr/local/bin:$PATH | |
| # http://bugs.python.org/issue19846 | |
| # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. | |
| ENV LANG C.UTF-8 | |
| ENV DEBIAN_FRONTEND noninteractive |
This file contains hidden or 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
| import os | |
| import sys | |
| import ssl | |
| import json | |
| import socket | |
| import asyncio | |
| import util | |
| async def proxy(node_id): | |
| dir = os.path.join(os.getcwd(), '.ray-delegate') |
This file contains hidden or 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
| import asyncio | |
| import os | |
| import ssl | |
| import json | |
| import secrets | |
| import util | |
| from ray.util import get_node_ip_address | |
| async def handle_echo(reader, writer): |
This file contains hidden or 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
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "reflect" | |
| "time" | |
| "github.com/rueian/rueidis" | |
| "github.com/rueian/rueidis/om" |
This file contains hidden or 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
| ▶ go test -bench=BenchmarkCond ./ring_test.go | |
| goos: darwin | |
| goarch: arm64 | |
| BenchmarkCond/Chan-size-64-parallelism-01-10 5995210 203.6 ns/op | |
| BenchmarkCond/Ring-size-64-parallelism-01-10 7178178 162.0 ns/op | |
| BenchmarkCond/Chan-size-64-parallelism-08-10 3785736 314.9 ns/op | |
| BenchmarkCond/Ring-size-64-parallelism-08-10 5421237 204.3 ns/op | |
| BenchmarkCond/Chan-size-64-parallelism-64-10 3847623 309.3 ns/op | |
| BenchmarkCond/Ring-size-64-parallelism-64-10 5169406 235.1 ns/op | |
| PASS |
This file contains hidden or 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
| var waits = int32(0) | |
| var sleep = int32(0) | |
| var cond = sync.Cond{L: (*emptyLock)(nil)} | |
| func makeRequest(req request, queue *ring) (resp response) { | |
| waits := atomic.AddInt32(&waits, 1) | |
| ch := queue.EnqueueRequest(queue) | |
| if waits == 1 { | |
| for atomic.LoadInt32(&sleep) != 0 { | |
| cond.Broadcast() |
This file contains hidden or 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
| package cond | |
| import ( | |
| "runtime" | |
| "sync" | |
| "sync/atomic" | |
| "testing" | |
| ) | |
| type Queue interface { |