Does openmp support nested loop?

hx w ye_hx_w@yahoo.com.cn
Thu Nov 25 04:15:00 GMT 2004


Hello, frineds,

i am studying the openmp API. I don't know  clearly
about that how to increase the performence at the
nested loop through paralleling.  Does openmp support
the nested loop? 
As follows:
=============================
#include <stdio.h>
int main()
{
  int i,j;
  for (i=0; i<=10; i++)
     for ( j=0; j<=10; j++ )
        larg_compute_function();
  exit(0);
}
==============================

I modified:
==============================
#include <stdio.h>
#include <omp.h>
int main()
{
  int i,j;
  omp_set_num_threads(4);
  #pragma omp parallel for
  for (i=0; i<=10; i++)
     #pragma omp parallel for
     for ( j=0; j<=10; j++ )
        larg_compute_function();
  exit(0);
}

=============================
After modifying, can i increasing the performence?
Any suggestions will be welcome! 
Thanks!



_________________________________________________________
Do You Yahoo!?
150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌÃ
http://cn.rd.yahoo.com/mail_cn/tag/yisou/music/*http://music.yisou.com/
ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
http://cn.rd.yahoo.com/mail_cn/tag/yisou/image/*http://image.yisou.com
1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/



More information about the Gcc mailing list