首页 \ 问答 \ 在OpenMP线程之间进行通信(Communicating between OpenMP threads)

在OpenMP线程之间进行通信(Communicating between OpenMP threads)

我有一个OpenMP循环,我希望在任何其他线程继续之前完成第一次迭代。 我已经尝试使用全局变量,初始化为'false',当第一次迭代结束时设置为'true',但这似乎没有按预期工作(我陷入无限循环)。

例如:

    bool FirstDone = false; // This is a global variable
    ...
    #pragma omp parallel for
    for(int i=0;i<max;i++)
    {
        while(!FirstDone && i>0){}

        if(i==0)
        {
            // Do something
            FirstDone = true;
        }
    }

任何人都可以阐明为什么这不起作用?


I have an OpenMP loop where I want the first iteration to complete before any of the other threads continue. I've tried using a global variable, initialized to 'false', which is set to 'true' when the first iteration finishes, but this doesn't appear to work as expected (I get stuck in an infinite loop).

For example:

    bool FirstDone = false; // This is a global variable
    ...
    #pragma omp parallel for
    for(int i=0;i<max;i++)
    {
        while(!FirstDone && i>0){}

        if(i==0)
        {
            // Do something
            FirstDone = true;
        }
    }

Can anyone shed light on why this isn't working?


原文:https://stackoverflow.com/questions/19356500
更新时间:2023-04-11 10:04

最满意答案

您需要在WAMP环境中设置新的root密码。 它有一个与XAMPP中不同的MySQL实例,因此它不会获取相同的root密码。 更改root密码并再次尝试连接,这应该有效。


You need to set a new root password within your WAMP environment. It has a different instance of MySQL to the one in XAMPP, so it won't pick up the same root password. Change the root password and try connecting again, that should work.

相关问答

更多
  • 建议你重新配置 wamp 网上有完整的教程 再如果数据库连接出错就是你的网站源码问题。
  • 错误'C:/ wamp / www'@'localhost'告诉你试图连接的用户是'C:/ wamp / www',而不是'root'。 你可以通过打印出来来检查$ dbconfig中的内容吗? 在phpmyadmin配置中更改密码实际上并不会从数据库本身更改密码。 Phpmyadmin只是一个客户端,而不是数据库。 要更改数据库中的密码,您应该使用任何客户端(如phpmyadmin)在'mysql'数据库'用户'表中更改它: 从phpmyadmin配置中删除用户名和密码 - 它将允许您使用网络形式登录。 ...
  • 您需要在WAMP环境中设置新的root密码。 它有一个与XAMPP中不同的MySQL实例,因此它不会获取相同的root密码。 更改root密码并再次尝试连接,这应该有效。 You need to set a new root password within your WAMP environment. It has a different instance of MySQL to the one in XAMPP, so it won't pick up the same root password. Ch ...
  • 在你的phpmyadmin config.inc.php中尝试这个: - $cfg['Servers'][$i]['verbose'] = 'localhost'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] ...
  • 在这里看到我的老指导,我的许多朋友有这个错误,这个指南的工程http://www.hieule.info/site/web/solve-the-denied-access-problem-when-using-wamp-server-2 -on-windows-8-希望这也适用于你。 See my old guide here, many of my friend has this error and this guide works http://www.hieule.info/site/web/solv ...
  • 检查错误的步骤: 1)检查您的apache配置:检查目标目录及以上目录条目。 注意订单和允许 (或要求 2.4+) 2)检查目标目录或以上是否有.htaccess文件。 再次,注意Allow / Deny和Require 。 3)检查403是否由apache或您的应用程序发出:在应用程序逻辑的最顶层添加一些调试消息(通常是某种index.php)。 Steps to check what's wrong: 1) Check your apache config: Check Directory-entrie ...
  • 它不是特别安全,但如果您将帐户名称添加到my.ini文件以及密码,它将适合您 # The following options will be passed to all MySQL clients [client] user = "Fred" password = "Bloggs" port = 3306 socket = /tmp/mysql.sock ... Its not particularly secure but if you add the acc ...
  • 问题得到解决。 在我的Windows上运行另一个php服务阻止了wamp服务器php服务。 所以我刚刚卸载了我不需要的服务。 The problem was fixed. There was an another php service running on my windows that blocked the wamp server php service. So i just unninstalled the service which i do not need.
  • 所以我在谷歌上搜索,但我没有尝试过。 所以我继续Youtube,在那里我找到了答案。 我会在这里发布Youtube密码视频链接,因为它比解释更容易,但我会给出一个简短的总结。 它是通过命令行完成的,并生成一个名为“mysql-init.txt”的.txt文件。 所以我必须创建一个.txt文件,其中包含使用mysql的命令并更新mysql.user表,并更新密码,然后刷新权限。 然后不得不关闭mysql服务器服务。 之后,我将“my.ini”文件移动到mysql服务器的文件夹中(对我来说是“MySQL Ser ...
  • 编辑config.inc.php文件。 $cfg['Servers'][$i]['verbose'] = 'localhost'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extensi ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)