Want to expose your machine learning model to the network? Use io.serve
:
import * as sm from '@shumai/shumai'
import { model } from './model'
import os | |
for cmd in ["add", "mm"]: | |
print(cmd) | |
for n in range(0, 14): | |
N = 2**n | |
best_cpu = 0 | |
best_cuda = 0 | |
for thread in [1, 2, 4, 8, 16, 32, 64, 80]: | |
full_cmd = f"OMP_NUM_THREADS={thread} python comp.py {cmd} {N}" |
import torch | |
import time | |
import sys | |
fn = sys.argv[1] | |
N = int(sys.argv[2]) | |
iters = 1000 | |
mps = torch.device("mps") | |
a = torch.randn(N, N) |
#include <cstdint> | |
extern "C" { | |
void init() {} | |
int64_t bytesUsed() { | |
return 0; | |
} |
// | |
// Metal.hpp | |
// | |
// Autogenerated on September 04, 2022. | |
// | |
// Copyright 2020-2021 Apple Inc. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at |
metal-cpp is a low overhead and header only C++ interface for Metal that helps developers add Metal functionality to graphics applications that are written in C++ (such as game engines). metal-cpp removes the need to create a shim and allows developers to call Metal functions directly from anywhere in their existing C++ code.
import * as sm from '@shumai/shumai' | |
class EvalTuner { | |
constructor() { | |
this.best_delta = 1 | |
this.best_time = Infinity | |
this.last_i = 0 | |
} | |
calculate_better_delta(time_spent) { |
// g++ bleh.cc --shared -o bleh.so -I$HOME/code/bun/src/napi -Wl,-undefined,dynamic_lookup | |
// | |
#include "node_api.h" | |
#include <iostream> | |
int a; | |
void *create() { | |
return (void*)&a; | |
std::cerr << "CREATING!\n"; | |
} |
// g++ ptr_test.cc --shared -o ptr_test.so | |
#include <cstdint> | |
static uint32_t g_p = 0; | |
extern "C" { | |
void* gen_ptr() { | |
return (void*)&g_p; | |
} |
import fs from "node:fs" | |
import readline from "node:readline" | |
const t0 = performance.now() | |
const stream = fs.createReadStream("input.txt") | |
const rl = readline.createInterface({ | |
input: stream, | |
crlfDelay: Infinity | |
}) |