Exemple #1
0
int main(int argc, char** argv)
{
	typedef BetheAnsatz::ParametersHeisenberg<RealType, InputNgType::Readable>
	        ParametersType;
	typedef ParallelTemperature<ParametersType> ParallelTemperatureType;
	typedef PsimagLite::Parallelizer<ParallelTemperatureType> ParallelizerType;

	int opt = 0;
	SizeType nthreads = 1;
	PsimagLite::String filename;
	BetheAnsatz::InputCheck inputCheck;
	PsimagLite::String usage(argv[0]);
	usage += " -f filename [-t threads]\n";

	while ((opt = getopt(argc, argv,"f:t:")) != -1) {
		switch (opt) {
		case 'f':
			filename = optarg;
			break;
		case 't':
			nthreads = atoi(optarg);
			break;
		default:
			inputCheck.usageMain(usage);
			return 1;
		}
	}

	if (filename == "") {
		inputCheck.usageMain(usage);
		return 2;
	}

	PsimagLite::Concurrency concurrency(&argc,&argv,nthreads);

	InputNgType::Writeable ioWriteable(filename,inputCheck);
	InputNgType::Readable io(ioWriteable);

	ParametersType params(io);
	std::cerr<<"Echo of Parameters read from "<<filename<<"\n";
	std::cerr<<params;
	std::cerr<<"Threads="<<PsimagLite::Concurrency::npthreads<<"\n";
	inputCheck.checkForThreads(PsimagLite::Concurrency::npthreads);

	ParallelizerType threadObject(PsimagLite::Concurrency::npthreads,
	                              PsimagLite::MPI::COMM_WORLD);
	ParallelTemperatureType parallelTemperature(params,nthreads);

	threadObject.loopCreate(params.tt,parallelTemperature);

	parallelTemperature.print(std::cout);
}
void spep::StartupProcessorImpl::beginSPEPStart()
{
	// Make sure we only start 1 thread..
	{
		ScopedLock lock( this->_startupResultMutex );
		
		if( this->allowProcessing() != STARTUP_NONE )
			return;
		
		// Set the startup result to 'wait' so that everything else will block.
		this->setStartupResult( STARTUP_WAIT );
	}
	
	StartupProcessorThread threadObject( this->_logger, this, this->_startupRetryInterval );
	this->_threadGroup.create_thread( threadObject );
}
Exemple #3
0
int main(int argc,char *argv[])
{
	int opt;
	PsimagLite::String file("");
	SizeType total=0;
	RealType offset = 0;
	RealType step = 0;
	SizeType centralSite =0;
	ObservableEnum what = OBS_SZ;

	while ((opt = getopt(argc, argv, "f:t:o:i:c:w:")) != -1) {
		switch (opt) {
		case 'f':
			file=optarg;
			break;
		case 't':
			total = atoi(optarg);
			break;
		case 'i':
			step = atof(optarg);
			break;
		case 'o':
			offset = atof(optarg);
			break;
		case 'c':
			centralSite = atoi(optarg);
			break;
		case 'w':
			if (PsimagLite::String(optarg) == "c")
				what = OBS_C;
			else if (PsimagLite::String(optarg) == "sz")
				what = OBS_SZ;
			else
				throw std::runtime_error("observable" +
			                             PsimagLite::String(optarg) +
			                             " not supported\n");
			break;
		default: /* '?' */
			throw std::runtime_error("Wrong usage\n");
		}
	}

	if (file=="") {
		throw std::runtime_error("Wrong usage\n");
	}

	FreeFermions::InputCheck inputCheck;
	InputNgType::Writeable ioWriteable(file,inputCheck);
	InputNgType::Readable io(ioWriteable);

	GeometryParamsType geometryParams(io);
	SizeType electronsUp = GeometryParamsType::readElectrons(io,geometryParams.sites);

	SizeType dof = 1;

	GeometryLibraryType geometry(geometryParams);

	std::cerr<<geometry;

	SizeType npthreads = 1;
	io.readline(npthreads,"Threads=");
	ConcurrencyType concurrency(&argc,&argv,npthreads);
	EngineType engine(geometry.matrix(),
	                  geometryParams.outputFile,
	                  dof,
	                  EngineType::VERBOSE_YES);
	PsimagLite::Vector<SizeType>::Type ne(dof,electronsUp);
	bool debug = false;
	HilbertStateType gs(engine,ne,debug);

	RealType Eg = 0;
	for (SizeType i=0;i<ne[0];i++) Eg += engine.eigenvalue(i);
	std::cerr<<"Energy="<<dof*Eg<<"\n";

	std::cout<<"#TotalNumberOfSites="<<geometryParams.sites<<"\n";
	std::cout<<"#OmegaTotal="<<total<<"\n";
	std::cout<<"#OmegaBegin="<<offset<<"\n";
	std::cout<<"#OmegaStep="<<step<<"\n";
	std::cout<<"#GeometryKind="<<geometryParams.geometry<<"\n";
	std::cout<<"#TSPSites 1 "<<centralSite<<"\n";
	std::cout<<"#Threads="<<PsimagLite::Concurrency::codeSectionParams.npthreads<<"\n";
	std::cout<<"#What="<<what<<"\n";
	std::cout<<"#############\n";

	typedef PsimagLite::Parallelizer<SqOmegaParallel> ParallelizerType;
	ParallelizerType threadObject(PsimagLite::Concurrency::codeSectionParams);

	SqOmegaParams params(engine,gs,Eg,geometryParams.sites,centralSite,what);
	SqOmegaParallel helperSqOmega(params,total,step,offset);

	threadObject.loopCreate(helperSqOmega);

	helperSqOmega.print(std::cout);
}