Commit 2b456c32 by Francois Gygi

correct lda argument in blacs calls


git-svn-id: http://qboxcode.org/svn/qb/trunk@563 cba15fb0-1239-40c8-b417-11db7ca47a34
parent ab303e33
......@@ -3,7 +3,7 @@
// AtomSetHandler.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSetHandler.C,v 1.7 2007-10-19 17:05:17 fgygi Exp $
// $Id: AtomSetHandler.C,v 1.8 2008-01-13 23:04:46 fgygi Exp $
#if USE_XERCES
......@@ -98,11 +98,11 @@ void AtomSetHandler::endElement(const XMLCh* const uri,
buf[0] = current_atom_position.x;
buf[1] = current_atom_position.y;
buf[2] = current_atom_position.z;
as_.context().dbcast_send(3,1,buf,1);
as_.context().dbcast_send(3,1,buf,3);
buf[0] = current_atom_velocity.x;
buf[1] = current_atom_velocity.y;
buf[2] = current_atom_velocity.z;
as_.context().dbcast_send(3,1,buf,1);
as_.context().dbcast_send(3,1,buf,3);
}
else if ( locname == "position" )
......
......@@ -3,7 +3,7 @@
// Context.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Context.C,v 1.14 2007-10-19 16:24:04 fgygi Exp $
// $Id: Context.C,v 1.15 2008-01-13 23:04:46 fgygi Exp $
#include "Context.h"
#include <iostream>
......@@ -287,7 +287,7 @@ struct ContextRep
if ( len%(sizeof(int)/sizeof(char)) != 0 ) ilen++;
int* ibuf = new int[ilen];
s.copy((char*)ibuf,string::npos);
isend(ilen,1,ibuf,1,rdest,cdest);
isend(ilen,1,ibuf,ilen,rdest,cdest);
delete [] ibuf;
#endif
}
......@@ -300,7 +300,7 @@ struct ContextRep
int ilen = len/(sizeof(int)/sizeof(char));
if ( len%(sizeof(int)/sizeof(char)) != 0 ) ilen++;
int* ibuf = new int[ilen];
irecv(ilen,1,ibuf,1,rsrc,csrc);
irecv(ilen,1,ibuf,ilen,rsrc,csrc);
s.resize(len);
s.assign((char*)ibuf,len);
delete [] ibuf;
......
......@@ -3,7 +3,7 @@
// PSDAWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: PSDAWavefunctionStepper.C,v 1.14 2007-11-29 08:18:20 fgygi Exp $
// $Id: PSDAWavefunctionStepper.C,v 1.15 2008-01-13 23:04:46 fgygi Exp $
#include "PSDAWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -122,7 +122,7 @@ void PSDAWavefunctionStepper::update(Wavefunction& dwf)
// a and b contain the partial sums of a and b
double tmpvec[2] = { a, b };
wf_.sdcontext()->dsum(2,1,&tmpvec[0],1);
wf_.sdcontext()->dsum(2,1,&tmpvec[0],2);
a = tmpvec[0];
b = tmpvec[1];
......
......@@ -3,7 +3,7 @@
// SampleReader.C:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SampleReader.C,v 1.21 2007-11-29 08:21:51 fgygi Exp $
// $Id: SampleReader.C,v 1.22 2008-01-13 23:04:46 fgygi Exp $
#include "Sample.h"
......@@ -44,6 +44,8 @@ SampleReader::SampleReader(const Context& ctxt) : ctxt_(ctxt) {}
////////////////////////////////////////////////////////////////////////////////
void SampleReader::readSample (Sample& s, const string uri, bool serial)
{
Timer tm;
tm.start();
#if USE_XERCES
const char* encodingName = "UTF-8";
//SAX2XMLReader::ValSchemes valScheme = SAX2XMLReader::Val_Auto;
......@@ -247,9 +249,9 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
ctxt_.string_bcast(curr_atom_name,0);
ctxt_.string_bcast(curr_atom_species,0);
double buf[3];
ctxt_.dbcast_recv(3,1,buf,1,0,0);
ctxt_.dbcast_recv(3,1,buf,3,0,0);
curr_position = D3vector(buf[0],buf[1],buf[2]);
ctxt_.dbcast_recv(3,1,buf,1,0,0);
ctxt_.dbcast_recv(3,1,buf,3,0,0);
curr_velocity = D3vector(buf[0],buf[1],buf[2]);
//cout << ctxt_.mype() << ": receiving atom " << curr_atom_name << endl;
Atom* a = new Atom(curr_atom_name, curr_atom_species,
......@@ -275,7 +277,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
// domain
double buf[9];
ctxt_.dbcast_recv(9,1,buf,1,0,0);
ctxt_.dbcast_recv(9,1,buf,9,0,0);
D3vector a(buf[0],buf[1],buf[2]);
D3vector b(buf[3],buf[4],buf[5]);
D3vector c(buf[6],buf[7],buf[8]);
......@@ -287,7 +289,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
ctxt_.dbcast_recv(1,1,&ecut,1,0,0);
// reference_domain
ctxt_.dbcast_recv(9,1,buf,1,0,0);
ctxt_.dbcast_recv(9,1,buf,9,0,0);
D3vector ar(buf[0],buf[1],buf[2]);
D3vector br(buf[3],buf[4],buf[5]);
D3vector cr(buf[6],buf[7],buf[8]);
......@@ -318,7 +320,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
// domain
double buf[9];
ctxt_.dbcast_recv(9,1,buf,1,0,0);
ctxt_.dbcast_recv(9,1,buf,9,0,0);
D3vector a(buf[0],buf[1],buf[2]);
D3vector b(buf[3],buf[4],buf[5]);
D3vector c(buf[6],buf[7],buf[8]);
......@@ -330,7 +332,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
ctxt_.dbcast_recv(1,1,&ecut,1,0,0);
// reference_domain
ctxt_.dbcast_recv(9,1,buf,1,0,0);
ctxt_.dbcast_recv(9,1,buf,9,0,0);
D3vector ar(buf[0],buf[1],buf[2]);
D3vector br(buf[3],buf[4],buf[5]);
D3vector cr(buf[6],buf[7],buf[8]);
......@@ -346,12 +348,12 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
// process SlaterDet
// receive kpoint and weight
double buf[4];
ctxt_.dbcast_recv(4,1,buf,1,0,0);
ctxt_.dbcast_recv(4,1,buf,4,0,0);
current_wf->add_kpoint(D3vector(buf[0],buf[1],buf[2]),buf[3]);
// receive density_matrix
vector<double> dmat_tmp(current_wf->nst());
s.wf.context().dbcast_recv(s.wf.nst(),1,&dmat_tmp[0],1,0,0);
s.wf.context().dbcast_recv(s.wf.nst(),1,&dmat_tmp[0],s.wf.nst(),0,0);
dmat[current_ispin].push_back(dmat_tmp);
if ( !read_from_file )
......@@ -375,7 +377,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
//cout << sd->context().mype()
// << ": received size=" << size << endl;
assert(size==wftmpr_size);
sd->context().drecv(size,1,&wftmpr[0],1,0,0);
sd->context().drecv(size,1,&wftmpr[0],size,0,0);
//cout << sd->context().mype()
// << ": grid_function nloc=" << nloc
// << "received" << endl;
......@@ -587,4 +589,7 @@ void SampleReader::readSample (Sample& s, const string uri, bool serial)
<< endl;
}
#endif
tm.stop();
if ( ctxt_.onpe0() )
cout << " <!-- SampleReader: read time: " << tm.real() << " s -->" << endl;
}
......@@ -3,13 +3,14 @@
// SampleWriter.C:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SampleWriter.C,v 1.2 2007-10-19 16:24:05 fgygi Exp $
// $Id: SampleWriter.C,v 1.3 2008-01-13 23:04:46 fgygi Exp $
#include "SampleWriter.h"
#include "Sample.h"
#include "fstream"
#include "qbox_xmlns.h"
#include "Timer.h"
#ifdef USE_CSTDIO_LFS
#include <cstdio>
......@@ -26,6 +27,8 @@ void SampleWriter::writeSample(const Sample& s, const string filename,
string description,
bool base64, bool atomsonly)
{
Timer tm;
tm.start();
// set default encoding
string encoding = base64 ? "base64" : "text";
const char* filename_cstr = filename.c_str();
......@@ -112,4 +115,8 @@ void SampleWriter::writeSample(const Sample& s, const string filename,
os.close();
#endif
tm.stop();
if ( ctxt_.onpe0() )
cout << " <!-- SampleWriter: write time: " << tm.real() << " s -->"
<< endl;
}
......@@ -3,7 +3,7 @@
// SlaterDet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: SlaterDet.C,v 1.42 2007-11-29 08:23:35 fgygi Exp $
// $Id: SlaterDet.C,v 1.43 2008-01-13 23:04:46 fgygi Exp $
#include "SlaterDet.h"
#include "FourierTransform.h"
......@@ -1200,14 +1200,14 @@ void SlaterDet::print(ostream& os, string encoding, double weight, int ispin,
int istart = ft.np0() * ft.np1() * ft.np2_first(i);
if ( !real_basis )
istart *= 2;
ctxt_.drecv(size,1,&wftmpr[istart],1,i,c_.pc(n));
ctxt_.drecv(size,1,&wftmpr[istart],size,i,c_.pc(n));
}
}
else
{
if ( iamsending )
{
ctxt_.dsend(size,1,&wftmpr[0],1,0,0);
ctxt_.dsend(size,1,&wftmpr[0],size,0,0);
}
}
}
......@@ -1377,14 +1377,14 @@ void SlaterDet::write(FILE* outfile, string encoding, double weight, int ispin,
int istart = ft.np0() * ft.np1() * ft.np2_first(i);
if ( !real_basis )
istart *= 2;
ctxt_.drecv(size,1,&wftmpr[istart],1,i,c_.pc(n));
ctxt_.drecv(size,1,&wftmpr[istart],size,i,c_.pc(n));
}
}
else
{
if ( iamsending )
{
ctxt_.dsend(size,1,&wftmpr[0],1,0,0);
ctxt_.dsend(size,1,&wftmpr[0],size,0,0);
}
}
}
......
......@@ -3,7 +3,7 @@
// WavefunctionHandler.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: WavefunctionHandler.C,v 1.14 2007-11-29 08:29:47 fgygi Exp $
// $Id: WavefunctionHandler.C,v 1.15 2008-01-13 23:04:46 fgygi Exp $
#if USE_XERCES
......@@ -149,7 +149,7 @@ void WavefunctionHandler::startElement(const XMLCh* const uri,
buf[0] = uc.a(0).x; buf[1] = uc.a(0).y; buf[2] = uc.a(0).z;
buf[3] = uc.a(1).x; buf[4] = uc.a(1).y; buf[5] = uc.a(1).z;
buf[6] = uc.a(2).x; buf[7] = uc.a(2).y; buf[8] = uc.a(2).z;
wf_.context().dbcast_send(9,1,buf,1);
wf_.context().dbcast_send(9,1,buf,9);
}
else if ( locname == "reference_domain")
{
......@@ -256,7 +256,7 @@ void WavefunctionHandler::startElement(const XMLCh* const uri,
buf[0] = ruc.a(0).x; buf[1] = ruc.a(0).y; buf[2] = ruc.a(0).z;
buf[3] = ruc.a(1).x; buf[4] = ruc.a(1).y; buf[5] = ruc.a(1).z;
buf[6] = ruc.a(2).x; buf[7] = ruc.a(2).y; buf[8] = ruc.a(2).z;
wf_.context().dbcast_send(9,1,buf,1);
wf_.context().dbcast_send(9,1,buf,9);
wf_.resize(uc,ruc,ecut);
}
......@@ -293,7 +293,7 @@ void WavefunctionHandler::startElement(const XMLCh* const uri,
double buf[4];
buf[0] = current_kx; buf[1] = current_ky; buf[2] = current_kz;
buf[3] = current_weight;
wf_.context().dbcast_send(4,1,buf,1);
wf_.context().dbcast_send(4,1,buf,4);
wf_.add_kpoint(D3vector(current_kx,current_ky,current_kz),current_weight);
assert(current_size==wf_.sd(current_ispin,current_ikp)->nst());
......@@ -356,7 +356,7 @@ void WavefunctionHandler::endElement(const XMLCh* const uri,
// send dmat to listening nodes
dmat_[current_ispin].push_back(dmat_tmp);
wf_.context().dbcast_send(dmat_tmp.size(),1,&dmat_tmp[0],1);
wf_.context().dbcast_send(dmat_tmp.size(),1,&dmat_tmp[0],dmat_tmp.size());
}
else if ( locname == "grid_function")
{
......@@ -429,7 +429,7 @@ void WavefunctionHandler::endElement(const XMLCh* const uri,
if ( !(prow==0 && pcol==0) )
{
sd->context().isend(1,1,&size,1,prow,pcol);
sd->context().dsend(size,1,&wftmpr[istart],1,prow,pcol);
sd->context().dsend(size,1,&wftmpr[istart],size,prow,pcol);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment