24小时热门版块排行榜    

CyRhmU.jpeg
查看: 1081  |  回复: 10
当前主题已经存档。
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

soaring1651

银虫 (小有名气)

[交流] 【求助】fluent并行计算UDF求助

现有两台同样配置的计算机。windows server2003系统。
想要并行计算,需要UDF。
自己的程序还没编好,就copy帮助文件中的实验,结果老是出现fatal error。
非常无奈,求助高手指点多机并行时UDF载入方法。
QQ:419222040。随时候教,望高手不吝指教。
回复此楼
贫富天命,成败由它
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

soaring1651

银虫 (小有名气)

是帮助文件中的UDF,不知会不会涉及版权,不管了,发。

★ ★
nono2009(金币+2,VIP+0):谢谢分享! 12-30 12:21
引用回帖:
Originally posted by hakekill at 2009-12-29 12:47:
我做过多核的udf,和单核的区别不大。

你最好是把udf发出来看看

#include "udf.h"

# define FLUID_ID 2

DEFINE_ON_DEMAND(pressures_to_file)
{
  /* Different variables are needed on different nodes */
#if !RP_HOST
Domain *domain=Get_Domain(1);
Thread *thread;
cell_t c;
#else
int i;
#endif

#if !RP_NODE
FILE *fp = NULL;
char filename[]="press_out.txt";
#endif

#if PARALLEL
int size;  /* data passing variables */
real *array;
int pe;
#endif
/* Only Serial and Compute Nodes have data on threads */
#if !RP_HOST
thread=Lookup_Thread(domain,FLUID_ID);
#endif

#if !RP_NODE /* SERIAL or HOST */
if ((fp = fopen(filename, "w")==NULL)
       Message("\n Warning: Unable to open %s for writing\n",filename);
else
       Message("\nWriting Pressure to %s...",filename);
#endif
/* UDF Now does 3 different things depending on SERIAL, NODE or HOST */

#if !PARALLEL /* SERIAL */
begin_c_loop(c,thread)
   fprintf(fp, "%g\n", C_P(c,thread));/* Simply write out pressure data */
end_c_loop(c,thread)
#endif /* !PARALLEL */

#if RP_NODE
/* Each Node loads up its data passing array */
size=THREAD_N_ELEMENTS_INT(thread);
array = (real *)malloc(size * sizeof(real));

begin_c_loop_int(c,thread)
   array[c]= C_P(c,thread);
end_c_loop_int(c,thread)
   /* Set pe to destination node */
   /* If on node_0 send data to host */
   /* Else send to node_0 because */
   /*   compute nodes connect to node_0 & node_0 to host */
pe = (I_AM_NODE_ZERO_P) ? node_host : node_zero;

PRF_CSEND_INT(pe, &size, 1, myid);
PRF_CSEND_REAL(pe, array, size, myid);

free(array);/* free array on nodes after data sent */

/* node_0 now collect data sent by other compute nodes */
/*   and sends it straight on to the host */
if (I_AM_NODE_ZERO_P)
   compute_node_loop_not_zero (pe)
   {
     PRF_CRECV_INT(pe, &size, 1, pe);
     array = (real *)malloc(size * sizeof(real));
     PRF_CRECV_REAL(pe, array, size, pe);
        
     PRF_CSEND_INT(node_host, &size, 1, myid);
     PRF_CSEND_REAL(node_host, array, size, myid);
        
     free((char *)array);
   }
#endif /* RP_NODE */

#if RP_HOST
compute_node_loop (pe) /* only acts as a counter in this loop */
   {
     /* Receive data sent by each node and write it out to the file */
     PRF_CRECV_INT(node_zero, &size, 1, node_zero);
     array = (real *)malloc(size * sizeof(real));
     PRF_CRECV_REAL(node_zero, array, size, node_zero);
     for (i=0; i        fprintf(fp, "%g\n", array);

     free(array);
   }
#endif /* RP_HOST */


#if !RP_NODE /* SERIAL or HOST */
fclose(fp); /* Close the file that was only opened if on SERIAL or HOST */
Message("Done\n";
#endif

}



ps:正版软件,服务期内,只是原公司被收购了。然后不理我,悲剧呀!
贫富天命,成败由它
6楼2009-12-30 12:12:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

soaring1651

银虫 (小有名气)

32位系统。fluent 6.3.26/fluent 12
贫富天命,成败由它
2楼2009-12-24 12:04:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zwenzhi

金虫 (小有名气)

我也遇到了和你一样的问题,我是XP系统,但是UDF就是有问题,,,期待高人解决
3楼2009-12-27 13:33:03
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hakekill

木虫 (小有名气)


nono2009(金币+1,VIP+0):谢谢参与!欢迎常来仿真模拟版交流。 12-29 12:50
nono2009(金币+0,VIP+0):欢迎去投票,寻找更多同行,同时领取金币。http://emuch.net/bbs/viewthread.php?tid=1649328 12-29 12:50
我做过多核的udf,和单核的区别不大。

你最好是把udf发出来看看
4楼2009-12-29 12:47:58
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复(可上传附件)
信息提示
请填处理意见