定时一个Fortran多线程程序 [英] Timing a Fortran multithreaded program

查看:335
本文介绍了定时一个Fortran多线程程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Fortran 90程序调用一个多线程例程。我想从调用例程中调用这个程序。如果我使用 cpu_time(),我最终将所有线程的cpu_time(在我的情况下为8)加到一起,而不是程序运行所需的实际时间。 etime()例程似乎也是这样做的。任何想法如何我可以计时这个程序(不使用秒表)?

解决方案

尝试 omp_get_wtime );请参阅 http://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fwtime.html签名。


I have a Fortran 90 program calling a multi threaded routine. I would like to time this program from the calling routine. If I use cpu_time(), I end up getting the cpu_time for all the threads (8 in my case) added together and not the actual time it takes for the program to run. The etime() routine seems to do the same. Any idea on how I can time this program (without using a stopwatch)?

解决方案

Try omp_get_wtime(); see http://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fwtime.html for the signature.

这篇关于定时一个Fortran多线程程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆