npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-nvrtc

v0.0.10

Published

`node-nvrtc`是一个简易的使用`nvrtc`的`node.js`扩展,目前只包含简单的`nvrtc`功能和`cuda`内存交换相关功能。

Readme

node-nvrtc 让Node.js使用NVRTC的扩展

node-nvrtc是一个简易的使用nvrtcnode.js扩展,目前只包含简单的nvrtc功能和cuda内存交换相关功能。

安装

npm install node-nvrtc

目前已经编译过的环境有win-x86_64以及linux-x86_64,编译的cuda版本为10.2,其他环境需要手动根据cuda开发环境重新进行编译。

如果要在win64或者linux-x86_64下直接使用的话需要安装cuda10.2

  • 需要注意的是nvrtc本身并不支持32位系统

使用

基本的使用方式如下

var NVRTC = require("node-nvrtc");

/**可用的设备数量 */
var deviceCount = NVRTC.getDeviceCount();

if(deviceCount <= 0){
  throw new Error("无法运行例子,因为并没有找到合适的设备");
}

//查看所有设备的信息
for(var i = 0;i < deviceCount;i++){
  console.log(`设备${i}`,NVRTC.getDeviceProperties(i));
}


/**用于计算的数据 */
var data = new Float32Array([1,2,3,4,5]);
/**显存空间 */
var cudaData = new NVRTC.CudaBuffer(data.byteLength);
//将js数据写入到cuda显存
cudaData.writeData(data.buffer);



/**用于测试的cuda代码,计算数的平方 */
var code = `my_program
__global__
void my_kernel(float* data) {
    data[threadIdx.x] = data[threadIdx.x] * data[threadIdx.x];
}`;

/**初始化计算用的启动器 */
var launcher = new NVRTC.CudaProgram(code).createKernel("my_kernel").createInstantiate([]).createLauncher([1,1,1],[data.length,1,1]);

//进行一次cuda运算
launcher.run(cudaData);

//读取计算结果
cudaData.readData(data.buffer);
console.log(data);