|
[Sponsors] |
January 27, 2011, 08:03 |
Does OS matter? Why?
|
#1 |
New Member
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15 |
The program(UDF) is complied successfully under Windows but doesn't work under Linux(Ubuntu 10.10.64bit). Why does this happen? Thanks!
Code:
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<udf.h> #include<math.h> #define K 4 #define mu 2.6 #define sigma 8.0 #define PI 3.1416926 #define maxi 10000000 float gauss(void) { float tmp; float u; float v; //float mu; // the expected value of Gauss Distrubution tmp=0; srand((unsigned)time(NULL)); while(mu-2>tmp||tmp>mu+2){ u=rand()*1.0/RAND_MAX; v=rand()*1.0/RAND_MAX; tmp=sqrt(-2*log(u))*cos(2*PI*v)*sigma+mu; } return tmp; } DEFINE_INIT(my_init_function, domain) { cell_t c; Thread *t; int i; int j; int cnum =14160; float *radius[maxi][K]; j=0; thread_loop_c(t,domain) { for(i=0;i<K;i++) *radius[j][i]=gauss(); j++; } } Last edited by coiby; January 27, 2011 at 10:27. |
|
January 27, 2011, 16:01 |
|
#2 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 |
Have you checked if your Linux version contains all the required compilers and files ? Like for example "gcc" ?
Do |
|
January 27, 2011, 22:24 |
|
#3 |
New Member
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15 |
DoHander, thanks for your attention. I check the problem again and find it's the style of comment that matters. In Fluent, you should use "/* */" to comment the codes instead of "//".
The Fluent uses cc as the compiler. But cc supports "//" comment style. Then the problem is due to parameters passed to cc. Code:
cc -fpic -shared -ansi -Wall -m32 -O -I/opt/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/opt/Fluent.Inc/fluent6.3.26/src -I/opt/Fluent.Inc/fluent6.3.26/cortex/src -I/opt/Fluent.Inc/fluent6.3.26/client/src -I/opt/Fluent.Inc/fluent6.3.26/tgrid/src -I/opt/Fluent.Inc/fluent6.3.26/multiport/src -I. -c my_init.func.c |
|
Tags |
fluent, linux, udf |
|
|