Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/compute/nvidia.tsx
Views: 687
import { GPU_SPECS } from "@cocalc/util/compute/gpu-specs";1import { commas, plural } from "@cocalc/util/misc";2import { Popover, Table } from "antd";3import { Icon } from "@cocalc/frontend/components/icon";4import { A } from "@cocalc/frontend/components/A";56export default function NVIDIA({7gpu,8count,9}: {10gpu: keyof typeof GPU_SPECS;11count: number;12}) {13const spec = GPU_SPECS[gpu];14return (15<Popover16title={17<div style={{ fontSize: "13pt" }}>18{spec != null && (19<div style={{ float: "right" }}>20{21<A href={spec.datasheet}>22<Icon name="external-link" /> Datasheet23</A>24}25</div>26)}27<Icon name="gpu" style={{ marginRight: "5px", fontSize: "16pt" }} />28{count} NVIDIA {gpu} {plural(count, "GPU")}29</div>30}31content={32<div style={{ width: "500px" }}>33<GPUSpecs gpu={gpu} count={count} />34</div>35}36>37<span38style={{39cursor: "pointer",40}}41>42{count} × NVIDIA {gpu} {plural(count, "GPU")}43</span>44</Popover>45);46}4748export function GPUSpecs({ gpu, count }) {49const spec = GPU_SPECS[gpu];50if (spec == null) {51console.warn({ gpu, GPU_SPECS });52return null;53}54const dataSource = [55{56key: "memory",57name: <b>GPU Memory</b>,58value: `${commas(count * spec.memory)} GB`,59per: `${commas(spec.memory)} GB`,60},61{62key: "memory_bw",63name: <b>Memory Bandwidth</b>,64per: `${commas(spec.memory_bw)} GB/s`,65},66];67if (spec.cuda_cores) {68dataSource.push({69key: "cuda_cores",70name: <b>CUDA cores</b>,71value: commas(count * spec.cuda_cores),72per: commas(spec.cuda_cores),73});74}75if (spec.tensor_cores) {76dataSource.push({77key: "tensor_cores",78name: <b>Tensor cores</b>,79value: commas(count * spec.tensor_cores),80per: commas(spec.tensor_cores),81});82}8384const columns = [85{86title: "",87dataIndex: "name",88key: "name",89},90{91title: "Per GPU",92dataIndex: "per",93key: "per",94},95{96title: "Total",97dataIndex: "value",98key: "value",99},100];101return (102<div>103<Table pagination={false} dataSource={dataSource} columns={columns} />104</div>105);106}107108109