小编cod*_*der的帖子

如何在 C++ 中使用 openmp 并行运行展开的“for”循环(tmp)?

代码 1 显示了使用 openmp 并行化“for”循环。我想在使用模板元编程展开“for”循环后实现类似的并行化(请参阅代码 2)。能否请你帮忙?

代码 1:外部 for 循环与四个线程并行运行

void some_algorithm()
{
  // code
}

int main()
{
  #pragma omp parallel for
  for (int i=0; i<4; i++)
  {
    //some code
    for (int j=0;j<10;j++)
    {
      some_algorithm()
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

代码 2:与代码 1 相同,我想使用 openmp 并行运行外部 for 循环。怎么做?1

template <int I, int ...N>
struct Looper{
    template <typename F, typename ...X>
    constexpr void operator()(F& f, X... x) {
        for (int i = 0; i < I; ++i) {
            Looper<N...>()(f, x..., i); …
Run Code Online (Sandbox Code Playgroud)

c++ templates openmp tmp

5
推荐指数
1
解决办法
105
查看次数

如何使用基本身份验证从仪表板应用程序中注销用户?

我是达世币新手。我正在 Dash 中开发一个应用程序,它使用基本身份验证(Dash-Auth)进行登录。我向用户提供预定义的用户名和密码。我使用用户名跟踪登录用户。我的问题是,如何在不关闭浏览器的情况下从应用程序中注销用户?我的意思是如何删除用户凭据,以便当用户下次尝试登录时,系统将再次提示用户输入用户名和密码?

python-3.x plotly-dash

5
推荐指数
0
解决办法
1181
查看次数

标签 统计

c++ ×1

openmp ×1

plotly-dash ×1

python-3.x ×1

templates ×1

tmp ×1