if an openmp code works on a single cpu with multi-threads, will it neccessarily work on a multi-processor machine?

if an openmp code works on a single cpu with multi-threads, will it neccessarily work on a multi-processor machine?

I am asking this question because I have had this strange problem for days. The code in question is parallelized using openmp directives, and runs well on my pc, a linux box that has only one cpu, but nevertheless I have set the enviroment variable OMP_NUM_THREADS to be 4 (or more). Now if I compile the same code on an SGI altix 3000, the results are drastically different and not correct. Both my pc and the SGI machine use ifort as compilor.

Should the fact that a code works on a single-CPU machine with multi-threads specified guarantee a correct behavior on a multi-processor machine? Or actually there is no relavance at all?

Any suggestion will be appreciated.

2 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

If you can run your case with thread checker, you have a reasonable chance of catching multi-processing issues. Call it strange if you like, but this is a large part of the reason for thread checker.

发表评论

登录添加评论。还不是成员?立即加入