Giter Site home page Giter Site logo

Comments (4)

ouonline avatar ouonline commented on July 18, 2024 1

如题:在主线程实例化全局engine,配置了3个线程,同时绑核;在被其他线程引用时,会变成单线程处理,这个问题需要如何处理?

使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例。这些 runtime 实例会共享模型权重(只读),但是有各自的运行时环境,可以并行处理不同的输入。

我的情况是封装了HTTP服务,每次收到请求后会起线程处理,处理完成后即刻销毁,这种情况适合使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例吗?

这种场景最好是创建一个线程池,每个线程持有一个 Runtime 实例,请求处理完之后不要销毁线程和 runtime,等服务退出的时候再销毁。

我发现全局runtime,在每次推理前重新ppl::nn::x86::SetGlobalOmpNumThreads(3); ppl::kernel::x86::set_omp_core_binding(nullptr, 0, 1);就能正常

这个是单个请求内的并行计算,不是并行处理多个请求,两者不是一个事。

from ppl.nn.

ouonline avatar ouonline commented on July 18, 2024

如题:在主线程实例化全局engine,配置了3个线程,同时绑核;在被其他线程引用时,会变成单线程处理,这个问题需要如何处理?

使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例。这些 runtime 实例会共享模型权重(只读),但是有各自的运行时环境,可以并行处理不同的输入。

from ppl.nn.

OMG59E avatar OMG59E commented on July 18, 2024

如题:在主线程实例化全局engine,配置了3个线程,同时绑核;在被其他线程引用时,会变成单线程处理,这个问题需要如何处理?

使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例。这些 runtime 实例会共享模型权重(只读),但是有各自的运行时环境,可以并行处理不同的输入。

我的情况是封装了HTTP服务,每次收到请求后会起线程处理,处理完成后即刻销毁,这种情况适合使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例吗?

我发现全局runtime,在每次推理前重新ppl::nn::x86::SetGlobalOmpNumThreads(3); ppl::kernel::x86::set_omp_core_binding(nullptr, 0, 1);就能正常

from ppl.nn.

OMG59E avatar OMG59E commented on July 18, 2024

如题:在主线程实例化全局engine,配置了3个线程,同时绑核;在被其他线程引用时,会变成单线程处理,这个问题需要如何处理?

使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例。这些 runtime 实例会共享模型权重(只读),但是有各自的运行时环境,可以并行处理不同的输入。

我的情况是封装了HTTP服务,每次收到请求后会起线程处理,处理完成后即刻销毁,这种情况适合使用 builder->CreateRuntime() 为每个线程创建单独的 Runtime 实例吗?

这种场景最好是创建一个线程池,每个线程持有一个 Runtime 实例,请求处理完之后不要销毁线程和 runtime,等服务退出的时候再销毁。

我发现全局runtime,在每次推理前重新ppl::nn::x86::SetGlobalOmpNumThreads(3); ppl::kernel::x86::set_omp_core_binding(nullptr, 0, 1);就能正常

这个是单个请求内的并行计算,不是并行处理多个请求,两者不是一个事。

了解,多谢

from ppl.nn.

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.