コード例 #1
0
 explicit kernel_matrix(const expansion_type& e,
                        const SA& sources)
     : e_(e),
       targets_(sources.begin(), sources.end()),
       sources_(sources.begin(), sources.end()),
       plan(nullptr) {
 }
コード例 #2
0
ファイル: variant.cpp プロジェクト: kyoconan/godot
inline DA _convert_array(const SA& p_array) {

	DA da;
	da.resize(p_array.size());

	for(int i=0;i<p_array.size();i++) {

		da.set( i, Variant(p_array.get(i)) );
	}

	return da;
}
コード例 #3
0
ファイル: stringarr_test.cpp プロジェクト: hoangmit/mscds
void check_starr(int n, const char* A[], const SA& sa) {
	ASSERT_EQ(n, sa.length());
	for (int i = 0; i < n; ++i) {
		std::string p = sa.get_str(i);
		ASSERT_EQ(p, A[i]);
	}
	for (int i = 0; i < n; ++i) {
		StringPtr pt = sa.get(i);
		unsigned slen = strlen(A[i]);
		ASSERT_EQ(slen, pt->length());
		ASSERT_EQ(0, strncmp(A[i], pt->c_str(), slen));
	}
}
コード例 #4
0
void main23()
{
	SA stackObject;	
	//	stackObject::SA::SA(); 

	SA *heapObject = new SA(); 
	/*
		SA *p = SA::operator new(sizeof(SA)); 
		p->SA::SA();				
	*/
	stackObject.doJob();
	heapObject->doJob();
}
コード例 #5
0
int bar(int a){
  int r = a;

  a1.foo();
  a2.foo();
  b1.foo();
  b2.foo();
  c1.foo();
  d1.foo();
  e1.foo();
  t1.foo();
  t2.foo();

  #pragma omp target teams
  ++r;

  return r + *R;
}
コード例 #6
0
int bar(int a){
  int r = a;

  a1.foo();
  a2.foo();
  b1.foo();
  b2.foo();
  c1.foo();
  d1.foo();
  e1.foo();
  t1.foo();
  t2.foo();

  #pragma omp target simd
  for (int i = 0; i < 10; ++i)
    ++r;

  return r + *R;
}
コード例 #7
0
ファイル: WC.cpp プロジェクト: linkaixing/WC
int main(int argc,char *argv[])
{
	InitInput initInput;
	initInput.init(argc,argv);
	bool useCWL=false;
	if(initInput.dir=="" && !initInput.x){
		cout<<"请输入参数!";
		return 0;
	}
	//输入-x时
	if(initInput.x){
		OPENFILENAME ofn;      // 公共对话框结构。     
		TCHAR szFile[MAX_PATH]; // 保存获取文件名称的缓冲区。               
		// 初始化选择文件对话框。     
		ZeroMemory(&ofn, sizeof(OPENFILENAME));    
		ofn.lStructSize = sizeof(OPENFILENAME);    
		ofn.hwndOwner = NULL;    
		ofn.lpstrFile = szFile;    
		ofn.lpstrFile[0] = '\0';   
		ofn.nMaxFile = sizeof(szFile);    
		ofn.lpstrFilter = "All(*.*)\0*.*\0Text(*.txt)\0*.TXT\0\0";    
		ofn.nFilterIndex = 1;    
		ofn.lpstrFileTitle = NULL;    
		ofn.nMaxFileTitle = 0;    
		ofn.lpstrInitialDir = NULL;    
		ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
		while(1){
			// 显示打开选择文件对话框。
			if ( GetOpenFileName(&ofn) ){ 
				CWL cwl;
				SA sa;
				ifstream file;
				file.open(szFile,ios::in);
				if(!file.good()){
					cout<<"文件打开失败!"<<endl;
					continue;
				}
				cwl.charCount(file);
				cwl.wordCount(file);
				cwl.lineCount(file);
				useCWL=true;
				sa.cal(file);
				file.close();
				if(useCWL)
					cout<<endl;
				cout<<"代码行数:"<<sa.codeRow<<endl;
				cout<<"空行数:"<<sa.nullRow<<endl;
				cout<<"注释行数:"<<sa.annoRow;
			}
			else
				break;
		}
	}
	//输入不是-x时
	else{
		//输入-c -w -l时
		if(!strstr(initInput.dir.c_str(),"*") && !strstr(initInput.dir.c_str(),"?") && (initInput.c || initInput.w || initInput.l)){
			CWL cwl;
			ifstream file;
			file.open(initInput.dir,ios::in);
			if(!file.good()){
				cout<<initInput.dir+"文件打开失败!";
				return 0;
			}
			if(initInput.c){
				cwl.charCount(file);
			}
			if(initInput.w){
				cwl.wordCount(file);
			}
			if(initInput.l){
				cwl.lineCount(file);
			}
			file.close();
			useCWL=true;
		}
		//输入-s -a时
		if(initInput.s || initInput.a){
			SA sa;
			if((initInput.dir[0]=='*' || initInput.dir[0]=='?') && initInput.dir[1]=='.'){
				if(initInput.s)
					sa.searchFile(sa.GetProgramDir().c_str(),initInput.dir,0);
				else
					sa.searchFile(sa.GetProgramDir().c_str(),initInput.dir,1);
			}
			else if(strstr(initInput.dir.c_str(),"*") || strstr(initInput.dir.c_str(),"?")){
				string str;
				if(strstr(initInput.dir.c_str(),"*"))
					str=strstr(initInput.dir.c_str(),"*");
				else
					str=strstr(initInput.dir.c_str(),"?");
				if(str[1]=='.'){
					string s=initInput.dir.substr(0,initInput.dir.length()-str.length());
					if(initInput.s)
						sa.searchFile(s.c_str(),str,0);
					else
						sa.searchFile(s.c_str(),str,1);
				}
				else
					sa.statfileurllist.push_back(initInput.dir);
			}
			else
				sa.statfileurllist.push_back(initInput.dir);
			for(int i=0;i<sa.statfileurllist.size();i++){
				ifstream file;
				file.open(sa.statfileurllist[i],ios::in);
				if(!file.good()){
					cout<<sa.statfileurllist[i]+"文件打开失败";
					return 0;
				}
				sa.cal(file);
				file.close();
			}
			if(useCWL)
				cout<<endl;
			cout<<"代码行数:"<<sa.codeRow<<endl;
			cout<<"空行数:"<<sa.nullRow<<endl;
			cout<<"注释行数:"<<sa.annoRow;
		}
		else{
			if(!useCWL)
				cout<<"请输入正确路径!";
		}
	}
	return 0;
}
コード例 #8
0
void SAclient(int arg) {
  SA<int,123> s;
  s.func(arg); // expected-note {{in instantiation of member function}}
  double marr[10][10][10];
  double marr2[5][10][1];
  double mvla[5][arg][10];
  double ***mptr;
  const int n = 0;
  const int m = 1;
  double mvla2[5][arg][m+n+10];

  SB *p;

  SD u;
  SC r(p),t(p);
  #pragma omp target teams map(r)
  {}
  #pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[2][3][0:2])
  {}
  #pragma omp target teams map(marr[:][:][:])
  {}
  #pragma omp target teams map(marr[:2][:][:])
  {}
  #pragma omp target teams map(marr[arg:][:][:])
  {}
  #pragma omp target teams map(marr[arg:])
  {}
  #pragma omp target teams map(marr[arg:][:arg][:]) // correct if arg is the size of dimension 2
  {}
  #pragma omp target teams map(marr[:arg][:])
  {}
  #pragma omp target teams map(marr[:arg][n:])
  {}
  #pragma omp target teams map(marr[:][:arg][n:]) // correct if arg is the size of  dimension 2
  {}
  #pragma omp target teams map(marr[:][:m][n:]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[n:m][:arg][n:])
  {}
  #pragma omp target teams map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:2][1:][:]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:2][:][1:]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:1][:2][:])
  {}
  #pragma omp target teams map(marr[:1][0][:])
  {}
  #pragma omp target teams map(marr[:arg][:2][:]) // correct if arg is 1
  {}
  #pragma omp target teams map(marr[:1][3:1][:2])
  {}
  #pragma omp target teams map(marr[:1][3:arg][:2]) // correct if arg is 1
  {}
  #pragma omp target teams map(marr[:1][3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr[:2][:10][:])
  {}
  #pragma omp target teams map(marr[:2][:][:5+5])
  {}
  #pragma omp target teams map(marr[:2][2+2-4:][0:5+5])
  {}

  #pragma omp target teams map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(marr2[:1][:2][0])
  {}

  #pragma omp target teams map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
  {}
  #pragma omp target teams map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
  {}
  #pragma omp target teams map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
   {}
  #pragma omp target teams map(mvla[1][2:arg][:])
  {}
  #pragma omp target teams map(mvla[:1][:][:])
  {}
  #pragma omp target teams map(mvla2[:1][:2][:11])
  {}
  #pragma omp target teams map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
  {}

  #pragma omp target teams map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(mptr[:1][:2-1][2:4-3])
  {}
  #pragma omp target teams map(mptr[:1][:arg][2:4-3]) // correct if arg is 1.
  {}
  #pragma omp target teams map(mptr[:1][:2-1][0:2])
  {}
  #pragma omp target teams map(mptr[:1][:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
  {}
  #pragma omp target teams map(mptr[:1][:][0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
  {}
  #pragma omp target teams map(mptr[:2][:1][0:2]) // expected-error {{array section does not specify contiguous storage}}
  {}

  #pragma omp target teams map(r.ArrS[0].B)
  {}
  #pragma omp target teams map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}}
  {}
  #pragma omp target teams map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}}
  {}
  #pragma omp target teams map(r.ArrS[0].Arr[1:23])
  {}
  #pragma omp target teams map(r.ArrS[0].Arr[1:arg])
  {}
  #pragma omp target teams map(r.ArrS[0].Arr[arg:23])
  {}
  #pragma omp target teams map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
  {}
  #pragma omp target teams map(r.ArrS[0].A, r.ArrS[1].A) // expected-error {{multiple array elements associated with the same variable are not allowed in map clauses of the same construct}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.ArrS[0].A, t.ArrS[1].A)
  {}
  #pragma omp target teams map(r.PtrS[0], r.PtrS->B) // expected-error {{same pointer derreferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.RPtrS[0], r.RPtrS->B) // expected-error {{same pointer derreferenced in multiple different ways in map clause expressions}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.S.Arr[:12])
  {}
  #pragma omp target teams map(r.S.foo()[:12]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
  {}
  #pragma omp target teams map(r.C, r.D)
  {}
  #pragma omp target teams map(r.C, r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.C) map(r.C) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.C, r.S)  // this would be an error only caught at runtime - Sema would have to make sure there is not way for the missing data between fields to be mapped somewhere else.
  {}
  #pragma omp target teams map(r, r.S)  // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
  {}
  #pragma omp target teams map(r.C, t.C)
  {}
  #pragma omp target teams map(r.A)   // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}}
  {}
  #pragma omp target teams map(r.Arr)
  {}
  #pragma omp target teams map(r.Arr[3:5])
  {}
  #pragma omp target teams map(r.Ptr[3:5])
  {}
  #pragma omp target teams map(r.ArrS[3:5].A)   // expected-error {{OpenMP array section is not allowed here}}
  {}
  #pragma omp target teams map(r.ArrS[3:5].Arr[6:7])   // expected-error {{OpenMP array section is not allowed here}}
  {}
  #pragma omp target teams map(r.ArrS[3].Arr[6:7])
  {}
  #pragma omp target teams map(r.S.Arr[4:5])
  {}
  #pragma omp target teams map(r.S.Ptr[4:5])
  {}
  #pragma omp target teams map(r.S.Ptr[:])  // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
  {}
  #pragma omp target teams map((p+1)->A)  // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
  {}
  #pragma omp target teams map(u.B)  // expected-error {{mapped storage cannot be derived from a union}}
  {}

  #pragma omp target data map(to: r.C) //expected-note {{used here}}
  {
    #pragma omp target teams map(r.D)  // expected-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
    {}
  }

  #pragma omp target data map(to: t.Ptr) //expected-note {{used here}}
  {
    #pragma omp target teams map(t.Ptr[:23])  // expected-error {{pointer cannot be mapped along with a section derived from itself}}
    {}
  }

  #pragma omp target data map(to: t.C, t.D)
  {
  #pragma omp target data map(to: t.C)
  {
    #pragma omp target teams map(t.D)
    {}
  }
  }

  #pragma omp target data map(to: t)
  {
  #pragma omp target data map(to: t.C)
  {
    #pragma omp target teams map(t.D)
    {}
  }
  }
}