$ cargo +nightly build --release
$ ./target/release/rsqlite3
sqlite> .open rrrrrruuuuuust.db
sqlite> CREATE TABLE opinions(x);
sqlite> insert into opinions(x) values (hex(randomblob(16)));
sqlite> insert into opinions(x) values (hex(randomblob(16)));
sqlite> insert into opinions(x) values (hex(randomblob(16)));
sqlite> insert into opinions(x) values (hex(randomblob(16)));
sqlite> select * from opinions;
x
--------------------------------
343D4BE24D07A96F8550B0942F664A6C
D6289536E4A8057EB44754358EACD31A
B4CA8E714CB57B11E7336263D214F30F
A6491CA289ABF90EB2D76F5E1F919272

$ brew tap spectralops/tap && brew install keyscope
# 使用方法
$ keyscope validate PROVIDER -p PARAM1 PARAM2 .. PARAM_N
# 验证密钥
$ keyscope validate github $GITHUB_TOKEN
# 支持的密钥提供者
$ keyscope validate --providers
# 需要哪些参数
$ keyscope validate github --requirements
#[test]
fn ui() {
let t = trycmd::TestCases::new();
t.pass("tests/cmd/*.toml");
}
$ ./dlm --inputFile ~/dlm/links.txt --outputDir ~/dlm/output --maxConcurrentDownloads 2
OPTIONS:
-i, --inputFile <inputFile> input file with links
-M, --maxConcurrentDownloads <maxConcurrentDownloads> used to limit the number of downloads in flight
-o, --outputDir <outputDir> output directory for downloads
use gpgpu::*;
fn main() -> GpuResult<()> {
let fw = Framework::default();
// Original CPU data
let cpu_data = (0..10000).into_iter().collect::<Vec<u32>>();
// GPU buffer creation
let buf_a = GpuBuffer::from_slice(&fw, &cpu_data); // Input
let buf_b = GpuBuffer::from_slice(&fw, &cpu_data); // Input
let buf_c = GpuBuffer::<u32>::new(&fw, cpu_data.len()); // Output
// Shader load from SPIR-V binary file
let shader_module = utils::shader::from_spirv_file(&fw, "<SPIR-V shader path>")?;
// or from a WGSL source file
let shader_module = utils::shader::from_wgsl_file(&fw, "<WGSL shader path>")?;
// Descriptor set creation
let desc_set = DescriptorSet::default()
.bind_buffer(&buf_a, GpuBufferUsage::ReadOnly)
.bind_buffer(&buf_b, GpuBufferUsage::ReadOnly)
.bind_buffer(&buf_c, GpuBufferUsage::ReadWrite);
// Kernel creation and enqueuing
fw.create_kernel_builder(&shader_module, "main") // Entry point
.add_descriptor_set(desc_set)
.build()
.enqueue(cpu_data.len() as u32, 1, 1); // Enqueuing, not very optimus 😅
let output = buf_c.read()?; // Read back C from GPU
for (a, b) in cpu_data.into_iter().zip(output) {
assert_eq!(a.pow(2), b);
}
Ok(())
}
原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。