Giter VIP home page Giter VIP logo

Comments (3)

heavenong avatar heavenong commented on May 19, 2024

ristretto work on cpu mode , set "cpu=0" ?

from mvision.

Ewenwan avatar Ewenwan commented on May 19, 2024

// 1.不加 --gpu=x,x,x,x,x 选项
// 2.使用--gpu=all 选项 如果计算机无CUDA设备,则设置为无GPU模式,仅使用CPU

void Quantization::SetGpu() {
// Parse GPU ids or use all available devices
vector gpus;
if (gpus_ == "all")
{
int count = 0;
#ifndef CPU_ONLY
CUDA_CHECK(cudaGetDeviceCount(&count));// 获取所有可以CUDA设备数量
#else
NO_GPU;
#endif
for (int i = 0; i < count; ++i)
{
gpus.push_back(i);
}
}
else if (gpus_.size())
{
vector strings;
// 字符串 --gpu=x,x,x,x,x
boost::split(strings, gpus_, boost::is_any_of(","));// 按 , 号分割==
for (int i = 0; i < strings.size(); ++i)
{
gpus.push_back(boost::lexical_cast(strings[i]));
}
}
else
{
CHECK_EQ(gpus.size(), 0);// 大于等于0 如果命令行参数中没有 --gpu=x,x,x,x,x 选项
}

// Set device id and mode
if (gpus.size() != 0)
{
LOG(INFO) << "Use GPU with device ID " << gpus[0];
Caffe::SetDevice(gpus[0]);
Caffe::set_mode(Caffe::GPU);
}
else
{
LOG(INFO) << "Use CPU.";
Caffe::set_mode(Caffe::CPU);
}
}

from mvision.

heavenong avatar heavenong commented on May 19, 2024

l 选项 如果计算机无CUDA设备,则设置为无GPU模式,仅使

thanks

from mvision.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.