59 bool use_tcharm_global =
false;
63 use_tcharm_global =
true;
64 TCHARM_Set_global(COMGLOB_ROCCOM, r, NULL);
76 #ifndef DOXYGEN_SHOULD_SKIP_THIS
77 inline static void remove_arg(
int *argc,
char ***argv,
int i) {
79 for (
int j=i;
j<*argc-1; ++
j) (*argv)[
j]=(*argv)[
j+1];
86 _mpi_initialized(
false), _errorcode(0), _exception_on(
true), _profile_on(0),
89 _attr_map.add_object(
"",NULL);
90 _func_map.add_object(
"",NULL);
94 _libdir = std::string(PREFIX);
97 const char *comhome = std::getenv(
"ROCCOM_HOME");
98 if ( comhome) _libdir = comhome;
100 comhome = std::getenv(
"ROCSTAR_HOME");
101 if ( comhome) _libdir = comhome;
104 if ( !_libdir.empty()) _libdir.append(
"/lib/");
107 std::map<int,int> verb_maps;
110 while ( argc && i<*argc) {
111 if ( std::strncmp((*argv)[i],
"-com-v", 6) == 0) {
113 const char *
s=(*argv)[
i]+6;
115 if ( s[0] !=
'\0') rank = std::atoi( s);
118 if ( *argc>i+1 && (*argv)[i+1][0]>=
'0' && (*argv)[i+1][0]<=
'9')
119 { verb = std::atoi( (*argv)[i+1]);
remove_arg( argc, argv, i+1); }
121 if ( rank == -1) set_verbose(verb);
122 else verb_maps[
rank] = verb;
126 else if ( std::strcmp((*argv)[i],
"-com-mpi") == 0) {
131 else if ( std::strcmp((*argv)[i],
"-com-home") == 0) {
132 if ( *argc>i+1 && (*argv)[i+1][0]>=
'0' && (*argv)[i+1][0]<=
'9') {
133 _libdir = (*argv)[i+1]; _libdir.append(
"/lib/");
147 MPI_Init( argc, argv);
152 std::map<int,int>::const_iterator it=verb_maps.find( rank);
153 if ( it!=verb_maps.end()) set_verbose( it->second);
159 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
162 #elif defined(_POWER) || defined(__INTEL_COMPILER)
166 _cppobj_casting = -1;
169 if ( _debug && rank == 0) {
170 std::cerr <<
"Roccom Version 3.0. CVS $Id: Roccom_base.C,v 1.93 2008/12/06 08:43:25 mtcampbe Exp $" << std::endl;
171 std::cerr <<
"Roccom: Started with verbose level " << _verbose << std::endl;
174 std::cerr <<
"Roccom: MPI not initialized. Running in serial mode\n";
176 std::cerr <<
"Roccom: Running in serial mode with DUMMY_MPI\n";
189 COM::Roccom_base *ptr = get_roccom();
192 ptr =
new COM::Roccom_base( argc, argv);
212 const std::string &wname)
throw(
int)
216 std::cerr <<
"Roccom: Loading module " << lname
217 <<
" with arguments " << wname <<
"..." << std::endl;
220 std::string lname_found;
223 int index = _module_map.find(lname).first;
225 std::string lname_short = std::string(
"lib") + lname +
".so";
226 std::string lname_full = _libdir + lname_short;
229 handle = dlopen( lname_full.c_str(), RTLD_LAZY);
231 std::cerr <<
"dlopen error: " << dlerror() << std::endl;
233 if ( handle == NULL && !_libdir.empty()) {
234 handle = dlopen( lname_short.c_str(), RTLD_LAZY);
236 std::cerr <<
"dlopen error: " << dlerror() << std::endl;
237 lname_found = lname_short;
240 lname_found = lname_full;
243 if ( handle == NULL) {
245 if ( _libdir.empty()) libs = lname_full;
246 else libs = lname_full+
" or "+lname_short;
249 "Roccom_base::load_module");
254 _module_map[index].first = handle;
257 handle = _module_map[index].first;
260 _module_map[index].second.insert(wname);
263 std::string fname = lname +
"_load_module";
269 void *fptr = dlsym( handle, fname.c_str());
272 typedef void(*Func1)(
const char*);
273 (*(Func1)fptr)( wname.c_str());
277 int ibegin= ( _f90_mangling == -1 ) ? 0 : _f90_mangling;
278 int iend = (_f90_mangling == -1) ? 4: _f90_mangling;
285 for (
int i=ibegin; i<=
iend; ++
i) {
287 std::transform( fname.begin(), fname.end(), fname.begin(), toupper);
289 std::transform( fname.begin(), fname.end(), fname.begin(), tolower);
291 if ( i==2 || (i==3&&i==ibegin)) fname.append(
"_");
292 if (i==4) { fname.append(
"_");
if (ibegin == 4) fname.append(
"_"); }
294 fptr = dlsym( handle, fname.c_str());
295 if ( fptr) { _f90_mangling =
i;
break; }
300 typedef void(*Func2)(
const char*,
long int);
301 (*(Func2)fptr)( wname.c_str(), wname.size());
305 if ( ibegin == iend) msg = fname+
" in "+lname_found;
306 else msg = fname +
" or any its lowercase w/o underscore in " + lname;
308 msg.append(
"\nError message from libdl is: ");
309 msg.append( dlerror());
311 "Roccom_base::load_module");
319 std::cerr <<
"Roccom: Module " << lname <<
" loaded." << std::endl;
325 const std::string &wname,
int dodl)
throw(
int) {
329 std::cerr <<
"Roccom: Unloading module " << lname <<
"..." << std::endl;
332 int index = _module_map.find(lname).first;
335 "Roccom_base::unload_module");
337 std::set<std::string> &obj = _module_map[index].second;
341 if ( wname.empty() && obj.size()>1)
343 "Roccom_base::unload_module");
345 std::set<std::string>::iterator it = wname.empty()?obj.begin():obj.find( wname);
350 "Roccom_base::unload_module");
353 std::string fname = lname +
"_unload_module";
354 std::string wname_str=wname.size()?wname:*obj.begin();
356 void *handle = _module_map[index].first;
357 void *fptr = dlsym( handle, fname.c_str());
360 typedef void(*Func1)(
const char*);
361 (*(Func1)fptr)( wname_str.c_str());
364 if ( _f90_mangling != -1) {
365 if ( _f90_mangling & 1 == 1)
366 std::transform( fname.begin(), fname.end(), fname.begin(), toupper);
368 std::transform( fname.begin(), fname.end(), fname.begin(), tolower);
370 if ( _f90_mangling ==2 || _f90_mangling == 3) fname.append(
"_");
372 fptr = dlsym( handle, fname.c_str());
377 typedef void(*Func2)(
const char*,
long int);
378 (*(Func2)fptr)( wname_str.c_str(), wname_str.size());
382 "Roccom_base::unload_module");
388 if ( dodl && obj.size()==0) {
390 _module_map.remove_object( lname);
394 std::cerr <<
"Rocccom: Module " << lname <<
" unloaded" << std::endl;
402 if ( comm == MPI_COMM_NULL) comm = _comm;
406 std::cerr <<
"Roccom: Creating window \"" << name <<
'"'
407 <<
" with communicator " << comm << std::endl;
409 if ( _window_map.find( name).second)
413 _window_map.add_object( name,
new Window( name, comm));
418 std::string
s(
"When processing "); s.append(name);
419 proc_exception( ex, s);
427 get_window( wname).init_done(panechanged);
433 std::string msg = std::string(
"When completing the init of window ")+wname;
434 proc_exception( ex, msg);
437 std::cerr <<
"Roccom: Done creating window \"" << wname
445 std::cerr <<
"Roccom: Deleting window \"" << name <<
'"' << std::endl;
447 _window_map.remove_object( name);
454 s = s +
"When processing window " + name;
455 proc_exception( ex, s);
460 const int pane_id)
throw(
int)
464 std::cerr <<
"Roccom: Delete pane " << pane_id <<
" of window "
467 get_window( wname).delete_pane( pane_id);
473 std::sprintf( buf,
"%d", pane_id);
474 std::string msg = std::string(
"When processing window ")
475 + wname +
" for pane " + buf;
476 proc_exception( ex, msg);
483 os <<
"STRING";
break;
485 os <<
"METADATA";
break;
489 os <<
"COM_Object";
break;
491 os <<
"F90POINTER";
break;
496 os <<
"double";
break;
503 os <<
"float";
break;
505 os <<
"logical";
break;
508 os <<
"MPI_Comm";
break;
510 os <<
"type(" << type <<
")";
520 const std::string &unit)
throw(
int)
524 std::cerr <<
"Roccom: new attribute \"" << wa
525 <<
"\"\nRoccom:\tLocation: " << loc <<
"\nRoccom:\tType: ";
527 std::cerr <<
"\nRoccom:\tSize: " << size <<
"\nRoccom:\tUnit: \"" << unit <<
"\""
532 std::string wname, aname;
533 split_name( wa, wname, aname);
535 get_window( wname).new_attribute( aname, loc, type, size, unit);
541 s = s +
"When processing attribute " + wa;
542 proc_exception( ex, s);
552 std::cerr <<
"Roccom: delete attribute \"" << wa << std::endl;
555 std::string wname, aname;
556 split_name( wa, wname, aname);
558 get_window( wname).delete_attribute( aname);
564 s = s +
"When processing attribute " + wa;
565 proc_exception( ex, s);
570 int nitems,
int ng)
throw(
int)
574 std::cerr <<
"Roccom: Set size for attribute \""
575 << wa <<
'"' <<
" on pane " << pid
576 <<
" to " << nitems <<
" items with " << ng
577 <<
" ghosts" << std::endl;
581 std::string wname, aname;
582 split_name( wa, wname, aname);
584 get_window( wname).set_size( aname, pid, nitems, ng);
590 s = s +
"When processing attribute " + wa;
591 proc_exception( ex, s);
599 typedef void(COM_Object::*Member_Func)(
int *);
603 int ierr; (
reinterpret_cast<COM_Object*
>((
void *)&obj)->*f)( &ierr);
615 else *ierr = COM_Object::validate_object();
626 void *obj_addr,
void *casted_addr)
throw(
int)
630 get_attribute( wa, NULL, NULL, &size, NULL);
633 if ( obj_addr == casted_addr) {
634 set_array( wa, pid, obj_addr);
638 if ( _cppobj_casting == -1)
641 if ( _cppobj_casting)
642 set_array( wa, pid, casted_addr, (
char*)casted_addr-(
char*)obj_addr);
644 set_array( wa, pid, obj_addr);
649 void **ptr)
throw(
int)
652 get_array( wa, pid, ptr, &strd);
654 if ( strd <= 1)
return;
else *(
char**)ptr -= strd;
659 void *addr,
int strd,
int cap,
660 bool is_const)
throw(
int)
664 std::cerr <<
"Roccom: Set array for \"" << wa <<
"\" on pane "
665 << pid <<
" to " << addr <<
" with stride ";
666 if ( strd) std::cerr << strd;
667 else std::cerr <<
"==#components";
669 std::cerr <<
" and capacity ";
671 if ( cap) std::cerr << cap;
672 else std::cerr <<
"==#items";
674 std::cerr << std::endl;
677 std::string wname, aname;
678 split_name( wa, wname, aname);
680 get_window( wname).set_array( aname, pid, addr, strd, cap, is_const);
686 s = s +
"When processing attribute " + wa;
687 proc_exception( ex, s);
692 const void *lbnd,
const void *ubnd)
throw(
int)
696 void **addr,
int strd,
int cap)
throw(
int)
700 std::cerr <<
"Roccom: Allocate array for \"" << wa <<
"\" on pane "
701 << pid <<
" with stride ";
702 if ( strd) std::cerr << strd;
703 else std::cerr <<
"==#components";
705 std::cerr <<
" and capacity ";
707 if ( cap) std::cerr << cap;
708 else std::cerr <<
"==#items";
710 std::cerr << std::endl;
713 std::string wname, aname;
714 split_name( wa, wname, aname);
716 get_window( wname).alloc_array( aname, pid, addr, strd, cap);
722 s = s +
"When processing attribute " + wa;
723 proc_exception( ex, s);
728 void **addr,
int strd,
int cap)
throw(
int) {
731 std::cerr <<
"Roccom: Resize array for \"" << wa <<
"\" on pane "
732 << pid <<
" with stride ";
733 if ( strd<0) std::cerr <<
"==current";
734 else if (strd) std::cerr << strd;
735 else std::cerr <<
"==#components";
737 std::cerr <<
" and capacity ";
739 if ( cap) std::cerr << cap;
740 else std::cerr <<
"==#items";
742 std::cerr << std::endl;
745 std::string wname, aname;
746 split_name( wa, wname, aname);
748 get_window( wname).resize_array( aname, pid, addr, strd, cap);
754 s = s +
"When processing attribute " + wa;
755 proc_exception( ex, s);
760 const void *val,
int v_strd,
int v_size)
throw(
int)
764 std::cerr <<
"Roccom: Appending array " << val <<
" for \"" << wa
765 <<
"\" on pane " << pid <<
" with stride " << v_strd
766 <<
" and size " << v_size << std::endl;
768 std::string wname, aname;
769 split_name( wa, wname, aname);
771 get_window( wname).append_array( aname, pid, val, v_strd, v_size);
776 std::string
s(
"When processing attribute "); s.append(wa);
777 proc_exception( ex, s);
783 int withghost,
const char *cndname,
int val)
throw(
int)
787 std::cerr <<
"Roccom: Using attribute \"" << pwaname
788 <<
"\" onto \"" << waname <<
'"' << std::endl;
790 std::string pawname, paaname;
791 split_name( pwaname, pawname, paaname);
793 std::string awname, aaname;
794 std::string::size_type
ni = waname.find(
".");
795 if ( ni == std::string::npos) {
796 awname = waname; aaname =
"";
799 split_name( waname, awname, aaname);
801 std::string cawname, caaname;
802 if ( cndname && *cndname!=0)
803 split_name( cndname, cawname, caaname);
805 Attribute *cnd=caaname.
empty()?NULL:get_window(cawname).attribute(caaname);
806 if ( !caaname.empty() && cnd==NULL)
809 get_window(awname).inherit( get_window( pawname).attribute(paaname),
816 s = s +
"When window " + waname +
" uses attribute " + pwaname;
817 proc_exception( ex, s);
823 int withghost,
const char *cndname,
int val)
throw(
int)
827 std::cerr <<
"Roccom: Cloning attribute \"" << pwaname
828 <<
"\" onto \"" << waname <<
'"' << std::endl;
830 std::string pawname, paaname;
831 split_name( pwaname, pawname, paaname);
833 std::string awname, aaname;
834 std::string::size_type
ni = waname.find(
".");
835 if ( ni == std::string::npos) {
836 awname = waname; aaname =
"";
839 split_name( waname, awname, aaname);
841 std::string cawname, caaname;
842 if ( cndname && *cndname!=0)
843 split_name( cndname, cawname, caaname);
845 Attribute *cnd=caaname.
empty()?NULL:get_window(cawname).attribute(caaname);
846 if ( !caaname.empty() && cnd==NULL)
849 get_window(awname).inherit( get_window( pawname).attribute(paaname),
856 s = s +
"When window " + waname +
" clones attribute " + pwaname;
857 proc_exception( ex, s);
863 int withghost,
const char *cndname,
int val)
throw(
int)
867 std::cerr <<
"Roccom: Copying attribute \"" << pwaname
868 <<
"\" onto \"" << waname <<
'"' << std::endl;
870 std::string pawname, paaname;
871 split_name( pwaname, pawname, paaname);
873 std::string awname, aaname;
874 std::string::size_type
ni = waname.find(
".");
875 if ( ni == std::string::npos) {
876 awname = waname; aaname =
"";
879 split_name( waname, awname, aaname);
881 std::string cawname, caaname;
882 if ( cndname && *cndname!=0)
883 split_name( cndname, cawname, caaname);
885 Attribute *cnd=caaname.
empty()?NULL:get_window(cawname).attribute(caaname);
886 if ( !caaname.empty() && cnd==NULL)
889 get_window(awname).inherit( get_window( pawname).attribute(paaname),
896 s = s +
"When window " + waname +
" copies attribute " + pwaname;
897 proc_exception( ex, s);
903 int withghost,
int ptn_hdl,
int val)
throw(
int)
907 std::cerr <<
"Roccom: Copying attribute with handle \"" << src_hdl
908 <<
"\" onto \"" << trg_hdl <<
'"' << std::endl;
911 if ( trg_hdl <= 0 || src_hdl <= 0)
914 if ( _attr_map.is_immutable( trg_hdl))
917 Attribute *trg = &get_attribute(trg_hdl);
920 ptn_hdl?&get_attribute(ptn_hdl):NULL, val);
925 std::ostringstream sout;
927 sout <<
"When copying attribute " << src_hdl <<
" onto "
928 << trg_hdl <<
" with pattern attribute " << ptn_hdl;
929 proc_exception( ex, sout.str());
935 const int pid)
throw(
int)
939 std::cerr <<
"Roccom: Deallocate array for \"" << wa <<
"\" on pane "
940 << pid <<
" to" << std::endl;
942 std::string wname, aname;
943 split_name( wa, wname, aname);
945 get_window( wname).dealloc_array( aname, pid);
951 s = s +
"When processing attribute " + wa;
952 proc_exception( ex, s);
959 int *type,
int *size, std::string *unit)
throw(
int)
963 std::cerr <<
"Roccom: get attribute \"" << wa <<
"\"" << std::endl;
966 std::string wname, aname;
967 split_name( wa, wname, aname);
969 get_window( wname).get_attribute( aname, loc, type, size, unit);
973 if (loc) std::cerr <<
"Roccom:\tLocation: " << *loc
974 <<
"\nRoccom:\tType: ";
976 if ( size) std::cerr <<
"Roccom:\tSize: " << *size << std::endl;
977 if ( unit) std::cerr <<
"Roccom:\tUnit: \"" << *unit <<
"\"" << std::endl;
983 s = s +
"When processing attribute " + wa;
984 proc_exception( ex, s);
989 int *nitems,
int *ng)
throw(
int)
993 std::cerr <<
"Roccom: Get size for attribute \""
994 << wa <<
'"' <<
" for pane " << pid << std::endl;
998 std::string wname, aname;
999 split_name( wa, wname, aname);
1001 get_window( wname).get_size( aname, pid, nitems, ng);
1007 s = s +
"When processing attribute " + wa;
1008 proc_exception( ex, s);
1013 void **addr,
int *strd,
int *cap,
1014 bool is_const)
throw(
int)
1017 get_array( wa, pane_id, ptr, strd, cap, is_const);
1018 if (addr) *addr = ptr.
ptr;
1024 int *strd,
int *cap,
bool is_const)
throw(
int) {
1027 std::cerr <<
"Roccom: Get array for attribute \""
1028 << wa <<
'"' <<
" on pane " << pid << std::endl;
1032 std::string wname, aname;
1033 split_name( wa, wname, aname);
1035 get_window( wname).get_array( aname, pid, addr, strd, cap, is_const);
1038 std::cerr <<
"Roccom: ";
1039 if ( strd) std::cerr <<
" stride is " << *strd;
1040 if ( cap) std::cerr <<
" capacity is " << *cap;
1041 std::cerr << std::endl;
1049 s = s +
"When processing attribute " + wa;
1050 proc_exception( ex, s);
1059 std::cerr <<
"Roccom: Get status for attribute \""
1060 << wa <<
'"' <<
" on pane " << pid << std::endl;
1063 std::string wname, aname;
1064 split_name( wa, wname, aname,
false);
1066 Window **w = _window_map.find( wname).second;
1068 if ( aname.empty() && pid == 0) {
1069 if ( w == NULL)
return -1;
1076 std::cerr <<
"Roccom: ";
1077 std::cerr <<
" status is " << status << std::endl;
1086 s = s +
"When processing attribute " + wa;
1087 proc_exception( ex, s);
1094 void *val,
int v_strd,
int v_size,
1099 std::cerr <<
"Roccom: Copy array for attribute \""
1100 << wa <<
'"' <<
" on pane " << pid << std::endl;
1104 std::string wname, aname;
1105 split_name( wa, wname, aname);
1107 get_window( wname).copy_array( aname, pid, val, v_strd, v_size,
offset);
1110 std::cerr <<
"Roccom: ";
1111 std::cerr <<
" stride is " << v_strd;
1112 std::cerr <<
" size is " << v_size;
1113 std::cerr << std::endl;
1121 s = s +
"When processing attribute " + wa;
1122 proc_exception( ex, s);
1127 void *lbnd,
void *ubnd)
throw(
int)
1131 int pane_id)
throw(
int)
1141 return std::pair<int,int>(n/2-
sizeof(
void*), n-
sizeof(
void*));
1143 return std::pair<int,int>(0,n-
sizeof(
void*));
1148 Func_ptr f,
long int len)
throw(
int) {
1151 std::cerr <<
"Roccom: set pointer \"" << waname
1152 <<
" to " << ptr << std::endl;
1154 std::string wname, aname;
1155 split_name( waname, wname, aname);
1157 Attribute *a = get_window( wname).attribute( aname);
1164 std::pair<int,int> offs = get_f90pntoffsets( a);
1165 std::memcpy( a->
pointer(), (
char*)ptr-offs.first, offs.second);
1167 if ( offs.second<n) {
1168 *(
void**)((
char*)a->
pointer()+offs.second) =
1169 (
char*)a->
pointer()+offs.first+((
char*)len-(
char*)ptr);
1173 if ( _f90ptr_treat == FPTR_INSERT || _f90ptr_treat == FPTR_APPEND) {
1174 typedef void(*Func2)(
void*,
void*,
long int,
long int);
1175 *(
void**)((
char*)a->
pointer()+offs.first)=NULL;
1176 (*(Func2)f)( ptr, (
char*)a->
pointer()+offs.first,
1177 len, *(
long int*)((
char*)a->
pointer()+offs.second));
1180 typedef void(*Func2)(
void*,
void*);
1181 (*(Func2)f)( (
char*)ptr+offs.first, a->
pointer());
1185 std::cerr <<
"Roccom: copied values ";
1186 for (
int i=0,
ni=n/
sizeof(
void*); i<
ni; ++
i)
1187 std::cerr << ((
void**)a->
pointer())[i] <<
' ';
1188 std::cerr << std::endl;
1197 proc_exception( ex,
"");
1203 Func_ptr f,
long int len)
throw(
int) {
1206 std::cerr <<
"Roccom: get pointer \"" << waname
1207 <<
" into " << ptr << std::endl;
1209 std::string wname, aname;
1210 split_name( waname, wname, aname);
1212 Attribute *a = get_window( wname).attribute( aname);
1217 std::pair<int,int> offs = get_f90pntoffsets( a);
1220 if ( _f90ptr_treat == FPTR_INSERT || _f90ptr_treat == FPTR_APPEND) {
1221 typedef void(*Func2)(
void*,
void*,
long int,
long int);
1222 (*(Func2)f)( (
char*)a->
pointer()+offs.first, ptr,
1223 *(
long int*)((
char*)a->
pointer()+offs.second), len);
1226 typedef void(*Func2)(
void*,
void*);
1227 (*(Func2)f)( a->
pointer(), (
char*)ptr+offs.first);
1236 proc_exception( ex,
"");
1244 std::cerr <<
"Roccom: get the communicator of window \""
1245 << wname << std::endl;
1247 Window &w = get_window(wname);
1252 return MPI_COMM_NULL;
1257 s = s +
"When processing window " + wname;
1258 proc_exception( ex, s);
1264 get_panes(
const std::string &wname, std::vector<int> &paneids_vec,
1265 int rank,
int **pane_ids)
throw(
int){
1268 std::cerr <<
"Roccom: get pane ids of window \""
1269 << wname <<
"\" on ";
1270 if (
rank==-2) std::cerr <<
" this process";
1271 else if (
rank==-1) std::cerr <<
" all processes";
1272 else std::cerr <<
" process " <<
rank;
1274 std::cerr << std::endl;
1277 get_window(wname).panes( paneids_vec,
rank);
1280 *pane_ids =
new int[paneids_vec.size()];
1281 std::copy( paneids_vec.begin(), paneids_vec.end(), *pane_ids);
1288 s = s +
"When processing window " + wname;
1289 proc_exception( ex, s);
1297 std::cerr <<
"Roccom: get windows";
1302 std::cerr << std::endl;
1304 names = _window_map.get_names();
1316 s = s +
"When processing get_windows.";
1317 proc_exception( ex, s);
1325 std::cerr <<
"Roccom: get modules";
1330 std::cerr << std::endl;
1332 names = _module_map.get_names();
1344 s = s +
"When processing get_modules.";
1345 proc_exception( ex, s);
1350 std::string &str,
char **names)
throw(
int)
1354 std::cerr <<
"Roccom: get attributes of window \""
1355 << wname <<
'"' << std::endl;
1357 std::vector<Attribute*> as;
1358 get_window(wname).attributes( as);
1361 if ( natts) *natts = as.size();
1362 int i=0,
n=as.size();
1364 str = str + as[
i]->name();
1365 if ( ++i<
n) str.append(
" ");
1370 *names =
new char[str.size()+1];
1371 std::copy( str.begin(), str.end(), *names);
1372 (*names)[str.size()]=0;
1376 std::cerr <<
"Roccom: Got attribute names: " << str << std::endl;
1383 s = s +
"When processing window " + wname;
1384 proc_exception( ex, s);
1391 std::string &str,
char **names)
throw(
int)
1395 std::cerr <<
"Roccom: get connectivities of window \"" << wname
1396 <<
"\" on pane " << pane_id << std::endl;
1398 std::vector<Connectivity*> as;
1399 get_window(wname).pane( pane_id).connectivities( as);
1401 if ( natts) *natts = as.size();
1404 int i=0,
n=as.size();
1406 str = str + as[
i]->name();
1407 if ( ++i<
n) str.append(
" ");
1412 *names =
new char[str.size()+1];
1413 std::copy( str.begin(), str.end(), *names);
1414 (*names)[str.size()]=0;
1418 std::cerr <<
"Roccom: Got connectivity names: " << str << std::endl;
1425 s = s +
"When processing window " + wname;
1426 proc_exception( ex, s);
1432 std::string &str,
char **name)
throw(
int)
1436 std::cerr <<
"Roccom: get parent of attribute \"" << waname
1437 <<
"\" on pane " << pane_id << std::endl;
1439 std::string wname, aname;
1440 split_name( waname, wname, aname);
1442 get_window( wname).get_parent( aname, pane_id, str);
1445 *name =
new char[str.size()+1];
1446 std::copy( str.begin(), str.end(), *name);
1447 (*name)[str.size()]=0;
1451 std::cerr <<
"Roccom: Got parent name: " << str << std::endl;
1458 s = s +
"When processing attribute " + waname;
1459 proc_exception( ex, s);
1465 {
if ( buf)
delete [] *buf; *buf = NULL; }
1468 {
if ( buf)
delete [] *buf; *buf = NULL; }
1475 std::cerr <<
"Roccom: get handle of window \"" << wname <<
"\": ";
1476 std::pair<int,Window**> obj = _window_map.find( wname);
1483 if ( n>0) std::cerr << n << std::endl;
1484 else std::cerr <<
" not found" << std::endl;
1489 proc_exception( ex,
"");
1500 return _window_map[hdl-1];
1509 return _window_map[hdl-1];
1517 std::cerr <<
"Roccom: get const handle of attribute \""
1518 << waname <<
"\": ";
1520 std::string wname, aname;
1521 split_name( waname, wname, aname);
1523 Attribute *a = get_window( wname).attribute( aname);
1525 if ( a!=NULL) n=_attr_map.add_object( waname, a,
true);
1528 if ( n>0) std::cerr << n << std::endl;
1529 else std::cerr <<
" not found" << std::endl;
1534 proc_exception( ex,
"");
1544 std::cerr <<
"Roccom: get handle of attribute \"" << waname <<
"\": ";
1545 std::string wname, aname;
1546 split_name( waname, wname, aname);
1548 Attribute *a = get_window( wname).attribute( aname);
1550 if ( a!=NULL) n=_attr_map.add_object( waname, a,
false);
1553 if ( n>0) std::cerr << n << std::endl;
1554 else std::cerr <<
" not found" << std::endl;
1559 proc_exception( ex,
"");
1569 std::cerr <<
"Roccom: get handle of function \"" << wfname <<
"\": ";
1570 std::string wname, fname;
1571 split_name( wfname, wname, fname);
1573 Function *f = get_window( wname).function( fname);
1575 if ( f!=NULL) n=_func_map.add_object( wfname, f);
1578 if ( n>0) std::cerr << n << std::endl;
1579 else std::cerr <<
" not found" << std::endl;
1584 proc_exception( ex,
"");
1591 const std::string &intents,
1592 const COM_Type *types,
bool ff)
throw(
int) {
1596 int n=intents.size();
1597 std::cerr <<
"Roccom: init function \"" << wfname <<
'"'
1598 <<
" to " << ptr <<
" with " << n <<
" parameters";
1600 for (
int i=0; i<
n; ++
i) {
1601 std::cerr <<
"\nRoccom:\t" << intents[
i] <<
":";
1604 std::cerr << std::endl;
1606 std::string wname, fname;
1607 split_name( wfname, wname, fname);
1613 for (
int i=0, size=intents.size(); i<size; ++
i) {
1614 if (intents[i] !=
'i' && intents[i] !=
'o' && intents[i] !=
'b' &&
1615 intents[i] !=
'I' && intents[i] !=
'O' && intents[i] !=
'B')
1623 get_window( wname).set_function( fname, ptr, intents, types, NULL, ff);
1629 s = s +
"When processing attribute " + wfname;
1630 proc_exception( ex, s);
1638 const std::string &waname,
1639 const std::string &intents,
1641 bool ff)
throw(
int) {
1644 int n=intents.size();
1645 std::cerr <<
"Roccom: init function \"" << wfname <<
'"'
1646 <<
" to " << ptr <<
" with " << n <<
" parameters";
1647 for (
int i=0; i<
n; ++
i) {
1648 std::cerr <<
"\nRoccom:\t" << intents[
i] <<
":";
1650 if ( i==0) std::cerr <<
"\t\"" << waname <<
"\"";
1652 std::cerr << std::endl;
1654 std::string wname, fname;
1655 split_name( wfname, wname, fname);
1662 for (
int i=0, size=intents.size(); i<size; ++
i) {
1663 if (intents[i] !=
'i' && intents[i] !=
'o' && intents[i] !=
'b' &&
1664 intents[i] !=
'I' && intents[i] !=
'O' && intents[i] !=
'B')
1672 std::string wname1, aname1;
1673 split_name( waname, wname1, aname1);
1675 Attribute *a = get_window( wname1).attribute( aname1);
1684 get_window( wname).set_function( fname, ptr, intents, types, a, ff);
1690 s = s +
"When processing attribute " + wfname;
1691 proc_exception( ex, s);
1697 const std::string &waname,
1698 const std::string &intents,
1700 bool ff)
throw(
int) {
1701 set_member_function_helper( wfname, ptr, waname,
1702 intents, types, ff);
1706 Member_func_ptr ptr,
1707 const std::string &waname,
1708 const std::string &intents,
1710 bool ff)
throw(
int) {
1711 set_member_function_helper( wfname, ptr, waname,
1712 intents, types, ff);
1717 std::string wname, fname;
1718 split_name(wf, wname, fname);
1720 Function *func = get_window( wname).function( fname);
1729 Function *func = &get_function( wf);
1733 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1737 gettimeofday( &tv, NULL);
1739 return tv.tv_sec + tv.tv_usec*1.e-6;
1745 void **args,
const int *lens,
bool from_c)
throw(
int) {
1751 std::cerr <<
"Roccom: ************* CALL(" << _depth <<
") "
1752 <<
"on NOOP with " << count <<
" arguments" << std::endl;
1757 Function *func = &get_function( wf);
1759 int verb =
std::max(_verbose,
int(_func_map.verbs[ wf]))-_depth*2;
1760 if ( verb<=0) verb = 0;
1761 else verb = (verb+1)%2+1;
1763 std::cerr <<
"Roccom: CALL(" << _depth <<
") "
1764 << _func_map.name(wf);
1765 if ( _debug) std::cerr <<
'(';
1769 bool needpostproc=
false;
1779 int offset = (attr!=NULL);
1787 std::cerr << std::endl <<
"Roccom:\t" << func->
intent(0) <<
": ";
1794 std::pair<int,int> offs = get_f90pntoffsets( attr);
1796 ps[0] = (
char*)const_cast<void*>(attr->
pointer())+offs.first;
1800 if ( _f90ptr_treat == FPTR_INSERT) {
1801 *plen = *(
void**)((
char*)
const_cast<void*
>(attr->
pointer())
1807 ps[0] = (
char*)const_cast<void*>(attr->
pointer());
1810 std::cerr <<
"VALUE OF\t@" << ps[0] <<
"\t\""
1816 std::cerr <<
"METADATA\t@" << ps[0] <<
"\t\""
1821 for (
int i=offset; i<count; ++
i) {
1823 std::cerr << std::endl <<
"Roccom:\t" << func->
intent(i) <<
": ";
1829 char intent = func->
intent(i);
1833 if (lens && (intent==
'i' || intent==
'I' ||
1834 intent==
'b' || intent==
'B') &&
1835 ( lens[li]==0 || ((
char*)args[i])[lens[li]-1] !=
'\0')) {
1836 strs[
i].resize( lens[li]+1,
'\0');
1837 std::strncpy( &strs[i][0], (
char*)args[i], lens[li]);
1838 ps[
i] = &strs[
i][0];
1840 if (intent==
'b' || intent==
'B') needpostproc=
true;
1843 *plen = (
char*)NULL+std::strlen((
char*)ps[
i]); ++plen; ++lcount;
1847 *plen = (
char*)NULL+1; ++plen; ++lcount;
1852 strs[
i].resize( 2*
sizeof( MPI_Comm));
1853 ps[
i] = &strs[
i][0]+(
sizeof( MPI_Comm)-
1854 ((
long int)&strs[
i][0])%
sizeof(MPI_Comm));
1855 if (intent==
'i' || intent==
'I' || intent==
'b' || intent==
'B')
1857 if (intent==
'o' || intent==
'O' || intent==
'b' || intent==
'B')
1861 strs[
i].resize( 2*
sizeof(
int));
1862 ps[
i] = &strs[
i][0]+(
sizeof(int)-((
long int)&strs[
i][0])%
sizeof(
int));
1863 if (intent==
'i' || intent==
'I' || intent==
'b' || intent==
'B')
1865 if (intent==
'o' || intent==
'O' || intent==
'b' || intent==
'B')
1871 std::cerr <<
"STRING\t@" << args[
i] <<
"\t";
1872 if ( args[i]) std::cerr <<
'\"' << (
char*)ps[i] <<
'\"';
1875 std::cerr <<
"CHAR \t@" << args[
i] <<
"\t";
1876 if ( args[i]) std::cerr <<
'\'' << *(
char*)args[i] <<
'\'';
1880 std::cerr <<
"double\t@" << args[
i] <<
'\t';
1881 if ( args[i]) std::cerr << *(
double*)args[i];
1886 std::cerr <<
"int \t@" << args[
i] <<
'\t';
1887 if ( args[i]) std::cerr << *(
int*)args[i];
1891 std::cerr <<
"float \t@" << args[
i] <<
'\t';
1892 if ( args[i]) std::cerr << *(
float*)args[i];
1895 std::cerr <<
"logical\t@" << args[
i] <<
'\t';
1896 if ( args[i]) std::cerr << *(
int*)args[i];
1899 std::cerr <<
"MPI_Comm (C)\t@" << args[
i] <<
'\t';
1900 if ( args[i]) std::cerr << *(MPI_Comm*)args[i];
1903 std::cerr <<
"MPI_Comm (F)\t@" << args[
i] <<
'\t';
1904 if ( args[i]) std::cerr << *(
int*)args[i];
1907 std::cerr <<
"type(" << type <<
")\t@" << args[
i];
1912 int h=*(
int*)args[i];
1913 if ( h == 0 && func->
intent(i)<=
'Z') {
1917 std::cerr <<
"ZERO ATTRIBUTE HANDLE";
1922 const Attribute *attr = &get_attribute( h);
1927 ps[
i] =
const_cast<void*
>(attr->
pointer());
1929 std::cerr <<
"VALUE OF\t@" << ps[
i]
1930 <<
"\t\"" << _attr_map.name(h) <<
'"';
1935 std::cerr <<
"METADATA\t@" << ps[
i]
1936 <<
"\t\"" << _attr_map.
name(h) <<
'"';
1939 if ( _attr_map.is_immutable( h) &&
1940 toupper(func->
intent(i)) !=
'I') {
1951 if ( _f90ptr_treat == FPTR_APPEND) {
1952 std::pair<int,int> offs = get_f90pntoffsets( attr);
1955 *plen = *(
void**)((
char*)
const_cast<void*
>(attr->
pointer())+offs.second);
1964 std::cerr << std::endl <<
"Roccom: OPT\t" << func->
intent(i) <<
": ";
1969 if ( _debug) std::cerr << std::endl <<
"Roccom: )";
1970 std::cerr << std::endl;
1979 #ifdef _CHARM_THREADED_
1984 if ( _debug && lcount>0) {
1985 std::cerr <<
"Roccom: Invoking function with " << lcount
1986 <<
" additional implicit arguments: " << std::endl;
1987 for (
int i=0; i<lcount; ++
i) {
1990 std::cerr <<
"Roccom:\t@" << (
void *)p << std::endl;
1992 std::cerr <<
"Roccom:\t" << (
long int)p << std::endl;
2005 #ifdef _CHARM_THREADED_
2009 _func_map.counts[wf]++;
2011 double sec = tnew-t;
2012 _func_map.wtimes_tree[wf] += sec;
2013 _func_map.wtimes_self[wf] += sec;
2014 if (
int(_timer.size()) > _depth)
2015 _func_map.wtimes_self[wf] -= _timer[_depth];
2017 _timer.resize( _depth,0);
2018 if (_depth>0) _timer[_depth-1] += sec;
2019 if (_depth==0) _func_map.wtimes_tree[0] += sec;
2023 std::cerr <<
"Roccom: DONE(" << _depth <<
") " << std::endl;
2027 if ( needpostproc) {
2028 for (
int i=offset; i<count; ++
i) {
2030 char intent = func->
intent(i);
2032 if (intent==
'b' || intent==
'B') {
2033 int n = strs[
i].size();
2034 if ( n>0) std::memcpy( args[i], &strs[i][0], n-1);
2038 if (intent==
'o' || intent==
'O' || intent==
'b' || intent==
'B')
2042 if (intent==
'o' || intent==
'O' || intent==
'b' || intent==
'B')
2054 std::sprintf( buf,
"%d", wf);
2055 std::string msg = std::string(
"When processing function ");
2056 if ( wf>0) msg.append( _func_map.name(wf));
2058 msg.append(
" with handle "); msg.append( buf);
2059 proc_exception( ex, msg);
2065 _func_map.verbs[
i] = level;
2071 std::cerr <<
"Roccom: init profiling level to " << i << std::endl;
2080 if ( hdl == 0)
return;
2086 std::cerr <<
"Roccom: init profiling barrier for function handle " << hdl
2087 << std::endl <<
"Roccom:\tFunction: " <<
_func_map.
name(hdl)
2088 <<
" Communicator: " << comm << std::endl;
2093 if ( comm==MPI_COMM_NULL) comm =
_comm;
2100 std::sprintf( buf,
"Could not get function with handle %d", hdl);
2110 std::cerr <<
"Roccom: Appending profile into file \"" << fname
2111 <<
'"' << std::endl;
2113 std::multimap< double, int> profs;
2114 typedef std::multimap< double, int>::value_type MMVT;
2121 std::FILE *of = NULL;
2122 if ( fname.size() == 0)
2127 std::cerr <<
"Roccom: Could not open file \"" << fname
2128 <<
"\"\nRoccom: Giving up profiling" << std::endl;
2132 std::fputc(
'\n', of);
2134 if ( header.size() == 0)
2135 std::fputs(
"************************Roccom simple profiling tool\
2136 ************************", of);
2138 std::fputs( header.c_str(), of);
2140 std::fprintf( of,
"\n%32s%12s%14s%14s\n",
"Function",
"#calls",
2141 "Time(tree)",
"Time(self)");
2142 std::fputs(
"-------------------------------------------------------\
2143 ---------------------\n", of);
2145 std::multimap< double, int>::const_iterator
i,
iend;
2146 for ( i=profs.begin(), iend=profs.end(); i!=
iend; ++
i) {
2147 std::fprintf( of,
"%32.32s%12d%14g%14g\n",
2153 std::fputs(
"-------------------------------------------------------\
2154 ---------------------\n", of);
2155 std::fprintf( of,
"%32s%40g\n",
"Total(top level calls)",
2168 Window **w = _window_map.find( wname).second;
2179 if ( handle > 0 && handle<_attr_map.size())
2180 attr = _attr_map[handle];
2182 static char buf[10];
2183 std::sprintf( buf,
"%d", handle);
2194 if ( handle > 0 && handle<_attr_map.size())
2195 attr = _attr_map[handle];
2197 static char buf[10];
2198 std::sprintf( buf,
"%d", handle);
2209 if ( handle > 0 && handle<_func_map.size())
2210 func = _func_map[handle];
2213 static char buf[10];
2214 std::sprintf( buf,
"%d", handle);
2225 if ( handle > 0 && handle<_func_map.size())
2226 func = _func_map[handle];
2228 static char buf[10];
2229 std::sprintf( buf,
"%d", handle);
2239 std::string::size_type
ni = wa.find(
".");
2241 if ( ni == std::string::npos)
2244 wname = wa.substr( 0, ni);
2245 aname = wa.substr( ni+1, wname.size()-ni-1);
2248 if ( wname.empty() || aname.empty())
2262 _errorcode = ex.ierr;
2264 std::cerr <<
"\nRoccom:" << ex <<
s << std::endl;
2265 if ( _exception_on && _errorcode>=1000) {
2273 #if !defined(STATIC_LINK)
int COMMPI_Comm_rank(MPI_Comm c)
void use_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Use the subset of panes of another window of which the given pane attribute has value val...
void get_attribute(const std::string &wa_str, char *loc, int *type, int *size, std::string *unit)
Information retrieval Get the information about an attribute.
static void abort(int ierr)
void delete_window(const std::string &wname)
Deletes a window with given name.
void set_communicator(MPI_Comm c)
void swap(int &a, int &b)
void copy_array(const std::string &wa, const int pane_id, void *val, int v_strd=0, int v_size=0, int offset=0)
Copy an array from an attribute on a specific pane into a given buffer.
void validate_object(int *ierr)
int COM_Type
Indices for derived data types.
virtual ~COM_Object_derived()
A Function object corresponds to a function member of a window.
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
bool is_optional(int i) const
Check whether the ith argument is optional.
#define MAX_NAMELEN
The maxinum length of name string passed by users.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_SELF
void set_function(const std::string &wf, Func_ptr ptr, const std::string &intents, const COM_Type *types, bool ff=false)
Registers a function to the window.
Window & get_window(const std::string &wname)
Obtains a reference to the Window object from its name.
void get_attributes(const std::string &wname, int *na, std::string &str, char **names=NULL)
Obtain the user-defined attributes of the given window.
static void remove_arg(int *argc, char ***argv, int i)
Remove an argument from the argument list.
An Attribute object is a data member of a window.
int get_status(const std::string &aname, int pane_id) const
Get the status of an attribute or pane.
#define COM_assertion_msg(EX, msg)
void load_module(const std::string &lname, const std::string &wname)
Load a module.
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
int get_num_arguments(const std::string &wf)
Get the number of arguments of a given function "window.function".
void get_size(const std::string &wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute. The opposite of set_size.
A Window object contains multiple panes and multiple data attributes.
void deallocate_array(const std::string &wa, const int pid=0)
Deallocate space for an attribute in a pane, asuming the memory was allocated allocate_mesh or alloca...
std::pair< int, int > get_f90pntoffsets(const Attribute *a)
T COMMPI_Comm_f2c(int c, T)
int get_window_handle(const std::string &wname)
void unload_module(const std::string &lname, const std::string &wname, int dodl=1)
Unload a module.
Error_code ierr
Error code.
void proc_exception(const COM_exception &, const std::string &)
static void init(int *argc, char ***argv)
const std::string & name() const
Obtain the window's name.
real *8 function offset(vNorm, x2, y2, z2)
const std::string & name(int i) const
Name of the object.
int fclose(std::FILE *file)
Close a file, and check for possible errors.
const Window * window() const
Obtain a constant pointer to the parent window of the attribute.
int get_attribute_handle(const std::string &waname)
Shorter_size location() const
Obtain the location of the attribute.
Encapsulates the states of an exception.
void free_buffer(int **buf)
void set_member_function(const std::string &wf, Func_ptr ptr, const std::string &wa, const std::string &intents, const COM_Type *types, bool ff=false)
void delete_pane(const std::string &wname, const int pid)
Deletes a pane and its associated data.
std::vector< double > wtimes_tree
Accumulator of wall-clock time spent by itself and those functions called by it.
int COMMPI_Comm_size(MPI_Comm c)
std::string msg
Error message.
void resize_array(const std::string &wa, const int pane_id=0, void **addr=NULL, int strd=-1, int cap=0)
Resize an attribute on a specific pane and return the address by setting addr.
const void * pointer() const
Obtain a constant pointer to the physical address.
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to ** copy
std::pair< void *, std::set< std::string > > value_type
void set_size(const std::string &wa_str, int pane_id, int nitems, int ng=0)
Set the sizes of an attribute.
void print_profile(const std::string &fname, const std::string &header)
Window * get_window_object(int hdl)
MPI_Comm get_communicator(const std::string &wname)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
std::vector< double > wtimes_self
Accumulator of wall-clock time spent by itself excluding functions called by it.
void delete_attribute(const std::string &wa)
Delete an existing attribute from a window.
int _f90ptr_treat
Treatement of F90 pointers.
COM_BEGIN_NAME_SPACE void printStackBacktrace()
Print the stack backtrace.
MPI_Comm get_communicator() const
Obtain the communicator of the window.
void get_panes(const std::string &wname, std::vector< int > &paneids_vec, int rank=-2, int **pane_ids=NULL)
Obtain the panes of a given window on a specific process.
void set_object(const std::string &wa, const int pane_id, void *obj_addr, void *casted_obj)
Associates an object with a specific window.
void(* Func_ptr)()
Pointer of functions.
void get_connectivities(const std::string &wname, int pane_id, int *nc, std::string &str, char **names=NULL)
Obtain the connectivity tables of a pane of the given window.
void call_function(int wf, int count, void **args, const int *lens=NULL, bool from_c=true)
Invoke a function with given arguments.
std::vector< int > counts
Counts of the number of calls.
const std::string & name() const
Obtain the name of the attribute.
bool is_literal(int i) const
Check whether the ith argument is literal type.
MPI_Comm _comm
Default communicator of Roccom.
int get_status(const std::string &wa_str, int pane_id)
Get the status of an attribute.
COM_Type data_type(int i) const
Contains declarations of MPI subroutines used in Roccom.
void set_member_function_helper(const std::string &wf, T ptr, const std::string &wa, const std::string &intents, const COM_Type *types, bool ff=false)
void get_windows(std::vector< std::string > &)
Obtain a list of all window names.
void get_parent(const std::string &waname, int pane_id, std::string &str, char **name=NULL)
Obtain the parent attribute's name of a given attribute on a given pane.
bool _profile_on
Indicates whether should profile.
void new_window(const std::string &wname, MPI_Comm comm)
Creates a window with given name.
static int get_sizeof(MPI_Datatype i)
Get the size of a given MPI data type.
void clone_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Clone the subset of panes of another window of which the given pane attribute has value val...
void get_object(const std::string &wa, const int pane_id, void **ptr)
Associates an object with a specific window.
static Roccom_base * roccom_base
Function & get_function(const int)
Obtains a reference to an attribute from its handle.
void get_bounds(const std::string &wa, const int pane_id, void *lbnd, void *ubnd)
~Roccom_base()
Destructor.
int get_attribute_handle_const(const std::string &waname)
void print_type(std::ostream &os, COM_Type type)
static double get_wtime()
#define append_frame(s, frame)
Macro for appending the information about the given frame to the string s.
void get_f90pointer(const std::string &waname, void *ptr, Func_ptr f, long int l)
static void set_roccom(Roccom_base *)
Set the Roccom pointer to the given object.
void set_function_verbose(int i, int level)
void append_array(const std::string &wa, const int pane_id, const void *val, int v_strd, int v_size)
Append an array to the end of the attribute on a specific pane and return the new address by setting ...
This file indirectly includes the following files: iostream, map, string, vector, and roccom_basic...
void set_profiling_barrier(int hdl, MPI_Comm comm)
void set_bounds(const std::string &wa, const int pane_id, T lbnd, T ubnd)
void window_init_done(const std::string &wname, bool panechanged=true)
Marks the end of the registration of a window.
bool _debug
Indicated whether debug mode is on.
void set_f90pointer(const std::string &waname, void *ptr, Func_ptr f, long int l)
bool _mpi_initialized
Indicates whether MPI was initialized by Roccom.
int check_bounds(const std::string &wa, int pane_id)
int num_of_args() const
Get the number of arguments.
void int int REAL REAL REAL *z blockDim dim * ni
static Roccom_base * get_roccom()
Get a pointer to the Roccom object.
int split_name(const std::string &wa, std::string &wname, std::string &aname, bool tothrow=true)
Extracts the window and attribute names from "window.attribute".
COM_Type data_type() const
Obtain the data type of each component of the attribute.
void get_modules(std::vector< std::string > &)
Obtain a list of all module names.
void set_array(const std::string &wa, const int pane_id, void *addr, int strd=0, int cap=0, bool is_const=false)
Associates an array with an attribute for a specific pane.
bool is_rawdata(int i) const
Check whether the ith argument is raw.
void copy_attribute(const std::string &wname, const std::string &pwname, int withghost=1, const char *cndname=NULL, int val=0)
Copy an attribute onto another.
void get_array(const std::string &wa, const int pane_id, void **addr, int *strd=NULL, int *cap=0, bool is_const=false)
Get the address for an attribute on a specific pane.
void new_attribute(const std::string &wa, const char loc, const int data_type, int size, const std::string &unit)
Creates a new attribute for a window.
void allocate_array(const std::string &wa, const int pane_id=0, void **addr=NULL, int strd=0, int cap=0)
Allocate space for an attribute on a specific pane and return the address by setting addr...
bool empty() const
Check whether the number of items of the attribute is zero.
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
bool is_const() const
Returns whether the array is set to be read-only.
Attribute * inherit(Attribute *from, const std::string &aname, int inherit_mode, bool withghost, const Attribute *cond, int val)
Inherit the attributes of another window with a different name.
static int get_sizeof(COM_Type type, int count=1)
Gets the size of the data type given by its index.
void set_profiling(int i)
This subroutine turns on (or off) profiling if i==1 (or ==0).
static int get_sizeof(COM_Type type, int count=1)
Contains declaration of the base class for Roccom implementations.
int size_of_components() const
Obtain the number of components in the attribute.
int get_function_handle(const std::string &wfname)