Use this command
C:\Users\DELL>FreeFem+±mpi 05.15学习程序书.edp
to run the following program,
load “MPICG”
load “medit”
load “metis”
include “getARGV.idp”
include “MPIplot.idp”
include “MPIGMRESmacro.idp”searchMethod = 0;
assert(version >= 3.11);
real[int] ttt(10);
int ittt=0;
macro settt {ttt[ittt++] = mpiWtime();}//
verbosity=getARGV(“-vv”,0);
int vdebug=getARGV(“-d”,1);
int ksplit=getARGV(“-k”,10);
int nloc = getARGV(“-n”,25);
string sff=getARGV(“-p,”,“”);
int gmres=getARGV(“-gmres”,3);
bool dplot=getARGV(“-dp”,0);
int nC = getARGV(“-N” ,max(nloc/10,4));if (mpirank==0 && verbosity){
cout << "ARGV: ";
for (int i = 0; i < ARGV.n; ++i)
cout << ARGV[i] << " ";
cout << endl;
}if(mpirank==0 && verbosity)
cout << " vdebug: " << vdebug << ", kspilt "<< ksplit << ", nloc "<< nloc << ", sff "<<sff << “.” << endl;
but “cout” does not output the result. Why?
C:\Users\DELL>FreeFem+±mpi 05.20xuexi.edp
– FreeFem++ v4.1 (Sat, Nov 13, 2021 7:40:01 PM - git v4.10)
file : 05.20xuexi.edp
Load: lg_fem lg_mesh lg_mesh3 eigenvalue parallelempi
1 : load “MPICG”(load: loadLibary E:\FreeFem++\.\MPICG = 0)
2 : load “medit”(load: loadLibary E:\FreeFem++\.\medit = 0)
3 : load “metis”(load: loadLibary E:\FreeFem++\.\metis = 0) load: init metis (v 5 )4 : include "getARGV.idp" // for gestion of FreeFem++ argument and in version 3.10-1 FH 2 : // F. Hecht 3 : // Usage: getARGV(n,defaultvalue) // get the fist used default valeu 4 : // or getARGV(after,defaultvalue) // get the arg after after 5 : // the type of delfaut value given the return type: int,double, string 6 : // Modif version 3.54-2 Jan 2018 (add ones include)
96 & ENDIFMACROtARGV(“-n”," xxx") << endl;ng default)length-4 ) ii;.length-2 << endl;
8 @ macro getARGVidp 1 //
9 @
10 @
11 @ func int usedARGV(int n)
12 @ {
13 @ int k=1,ii=1,kk=1,ret=-1;
14 @ for(int i=1;i<ARGV.n;++i)
15 @ {
16 @ // cout <<i<< " “<< ARGV[i] << " " <<(ARGV[i]==”-v") << " " << kk << “==”
17 @ // << n << " " << ARGV[i].rfind(“dp”) << " " <<ARGV[i].length-2 << endl;
18 @
19 @ if(ARGV[i]==“-v”) i++;
20 @ else if(ARGV[i]==“-fglut”) i++;
21 @ else if(ARGV[i]==“-ffg”) i++;
22 @ else if(ARGV[i]==“-glut”) i++;
23 @ else if(ARGV[i]==“-f”) i++;
24 @ else if(ARGV[i]==“-nw”) ii;
25 @ else if(ARGV[i]==“-wait”) ii;
26 @ else if(ARGV[i]==“-ne”) ii;
27 @ else if(ARGV[i]==“-cd”) ii;
28 @ //else if(ARGV[i].rfind(“.edp”)==ARGV[i].length-4 ) ii;
29 @ else if(i==1) ii;
30 @ else if(kk++==n) {ret=i;}
31 @ // else cout << " +++ \n";
32 @ }
33 @ // cout << ret << endl;
34 @ return ret;
35 @ }
36 @
37 @ func int usedARGV(string after)
38 @ {
39 @ int ret=-1;
40 @ for(int i=ARGV.n-1;i>=0;–i)
41 @ if(ARGV[i]==after) { ret=++i; break;}
42 @ if(ARGV.n<ret) ret=-1;
43 @ return ret;
44 @ }
45 @
46 @ func int getARGV(int n,int default)
47 @ {
48 @ int d=default;
49 @ int k=usedARGV(n);
50 @ if(k>0) d=strtol(ARGV[k]);
51 @ return d;
52 @ }
53 @ func real getARGV(int n,real default)
54 @ {
55 @ real d=default;
56 @ int k=usedARGV(n);
57 @ if(k>0) d=strtod(ARGV[k]);
58 @ return d;
59 @ }
60 @ func string getARGV(int n,string default)
61 @ {
62 @ string d=default;
63 @ int k=usedARGV(n);
64 @ if(k>0) d=ARGV[k];
65 @ return d;
66 @ }
67 @
68 @ func int getARGV(string after,int default)
69 @ {
70 @ int d=default;
71 @ int k=usedARGV(after);
72 @ if(k>0) d=strtol(ARGV[k]);
73 @ return d;
74 @ }
75 @ func real getARGV(string after,real default)
76 @ {
77 @ real d=default;
78 @ int k=usedARGV(after);
79 @ if(k>0) d=strtod(ARGV[k]);
80 @ return d;
81 @ }
82 @ func string getARGV(string after,string default)
83 @ {
84 @ string d=default;
85 @ int k=usedARGV(after);
86 @ if(k>0) d=ARGV[k];
87 @ return d;
88 @ }
89 @
90 @ /*
91 @ cout << getARGV(1,100) << endl;
92 @ cout << getARGV(2,200.) << endl;
93 @ cout << getARGV(3,“300.000”) << endl;
94 @ cout << getARGV(“-n”," xxx") << endl;
95 @ /
96 @
31 # elseplot(uh,plotparm);y(rq1); )1[i-1]),uh[i][]);}u " << u.n << endl ;
44 # ) //EOM …;r;CommWorld);u);
45 :
6 : include “MPIGMRESmacro.idp”// MPIGMRSmacro.idp file… version 0.
2 : // include in MPIGMRES.edp file …
3 : // Frederic Hecht 2010
4 : // LGPL licence
5 : // Author Frederic.Hecht@upmc.fr
6 : // -------------------------------
7 :
8 : // macro to def // send-recv message
9 : // -----------------------------------
10 :
11 :
12 : func real maxM(matrix & A)
13 : {
14 : int[int] I(1),J(1);
15 : real[int] C(1);
16 : [I,J,C] =A;
17 : return C.max ;
18 : }
19 :
20 :
28 # ) //EOMU[j]=0;j];),aTh,U)
29 :
30 :
50 # ) //EOM<< " ++ISendRecvAny wait: get " << k << endl;n << endl;
51 :
52 :
62 # ) // EOM essor(comm,jpart[j]) >> Ri[j];
63 :
64 :
85 # cout << rj << " s ========= r " << rn[j] << " " << ipart << " ↔ " << in[j] << " " << 89 # } ) //EOM assert(err==0);
90 :
91 :
107 # ) // EOF int k= mpiWaitAny(rq);> Ri[j][];/Ri[j]);
108 :
109 :
110 :
7 :
8 : searchMethod = 0;
9 : assert(version >= 3.11);
10 : real[int] ttt(10);
11 : int ittt=0;
12 : macro settt {ttt[ittt++] = mpiWtime();}//
13 : verbosity=getARGV(“-vv”,0);
14 : int vdebug=getARGV(“-d”,1);
15 : int ksplit=getARGV(“-k”,10);
16 : int nloc = getARGV(“-n”,25);
17 : string sff=getARGV(“-p,”,“”);
18 : int gmres=getARGV(“-gmres”,3);
19 : bool dplot=getARGV(“-dp”,0);
20 : int nC = getARGV(“-N” ,max(nloc/10,4));
21 :
22 : if (mpirank==0 && verbosity){
23 : cout << "ARGV: ";
24 : for (int i = 0; i < ARGV.n; ++i)
25 : cout << ARGV[i] << " ";
26 : cout << endl;
27 : }
28 :
29 : if(mpirank==0 && verbosity)
30 : cout << " vdebug: " << vdebug << ", kspilt "<< ksplit << ", nloc "<< nloc << ", sff "<<sff << “.” << endl;
31 : sizestack + 1024 =1532 ( 508 )