From: David X. <dx...@my...> - 2006-03-07 21:53:08
|
I wrote a python script that loads the matrices exported in matllab and converts them to matrix market coordinate format that is required by spmatrix.ll_mat_from_mtx routine. Since the matlab output is almost identical to MM format, the conversion is easy and fast. I tested on two 70000x70000 matrices A and B (180MB each in file size). The conversion and loading finished in 5s. The JDSYM solver call took about 30~45s. Next I will see if I can implement JDSYM into my libmesh code. By the way, the print function in SparseMatrix/DenseMatrix class can only output to screen. I was wondering how you managed to export to file? David On 3/6/06, Ondrej Certik <on...@ce...> wrote: > I checked it again - so it's only 38000x38000 matrix, it took around 60s = to > load the element matrices (I assemble the big matrix in python, so it's p= retty > slow), and the solver ran for 22s. On smaller matrices the assembling is > faster. And of course it would be much faster if I clever renumbered the = nodes. > > Ondrej > > On Mon, Mar 06, 2006 at 01:41:33PM +0100, Ondrej Certik wrote: > > A few minutes on a fast amd64 comp. Loading the matrices takes around 1= 0% or > > 20% of the total time. It could be optimized more, but I just need it t= o work > > somehow now. > > > > On Mon, Mar 06, 2006 at 04:37:44AM -0800, David Xu wrote: > > > How long did it take for pysparse to solve the 300 000x300 000 matrix= ? > > > In my case, most of the time is wasted on loading the large matrices > > > into matlab. How long did it take for your python code to reassemble > > > the 300 000x300 000 matrices into pysparse required format? I'd love > > > to get pysparse working on my system and try it out. > > > > > > David > > > > > > On 3/6/06, Ondrej Certik <on...@ce...> wrote: > > > > I think I tried even something like 300 000 x 300 000 matrix with p= ysparse, and > > > > it was ok. the pysparse compiles without errors at my computer. For= my > > > > problems, the time spent assembling the matrices is negligible comp= ared to the > > > > solving time, so for me it's really no big deal to solve the matric= es > > > > elsewhere, I mainly use libmesh for the assembly and for that purpo= se the > > > > libmesh is a really, really great library. > > > > > > > > As to the solvers in libmesh - it's good they have one interface to= many > > > > solvers, because I believe one has to find the best method for each= equation > > > > one tries to solve with libmesh, maybe even for each problem. I pre= fer to > > > > have 2 programs, one for assembling, the other for solving, but tha= t's just my > > > > personal choice. Maybe it would be good to integrate pysparse to li= bmesh > > > > directly, but if it works that way, I really don't have the need. > > > > > > > > Ondrej > > > > > > > > > > > > On Sun, Mar 05, 2006 at 07:31:04PM -0800, David Xu wrote: > > > > > Ondrej, > > > > > > > > > > Thanks for tips. I tried to compile pysparse, but the program had > > > > > problems. So I instead used libmesh sparsematrix print_matlab opt= ion > > > > > and export the matrices A and B directly to matlab sparse matrix = file > > > > > format. The files can be directly loaded to matlab, which is very > > > > > convenient. Then the matrices A and B can be solved by matlab's e= igs > > > > > (using ARPACK) or jdcg_gep (a Jacobi-Davidson matlab routine). > > > > > > > > > > eigs is actually pretty fast, the only problem is it can't handle > > > > > large matrix. I tried 10201x10201. it gives me error. But jdcg_ge= p > > > > > solves the large matrix without problem and quite fast. I don't k= won > > > > > if the performance is comparable to jdsym in pysparse, but it's q= uite > > > > > good for me. > > > > > > > > > > I wish the libmesh team had implement the J-D algorithm in the co= de. > > > > > That would be very nice. > > > > > > > > > > Regards, > > > > > > > > > > David > > > > > > > > > > > > > > > > > > > > On 3/3/06, Ondrej Certik <on...@ce...> wrote: > > > > > > David, why don't you look in the documentation first? > > > > > > > > > > > > http://libmesh.sourceforge.net/doxygen/classDenseMatrixBase.htm= l > > > > > > > > > > > > void print (std::ostream &os) const > > > > > > void print_scientific (std::ostream &os) const > > > > > > > > > > > > Ondrej > > > > > > > > > > > > On Fri, Mar 03, 2006 at 01:12:18AM -0800, David Xu wrote: > > > > > > > Which class/functionof libmesh did you use to export the matr= ices. I > > > > > > > couldn't figure it out. Would you send me a piece of sample c= ode > > > > > > > please? > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > David > > > > > > > > > > > > > > On 3/1/06, Ondrej Certik <on...@ce...> wrote: > > > > > > > > Export them how you want, then read them in the python scri= pt. > > > > > > > > Ondrej > > > > > > > > > > > > > > > > On Wed, Mar 01, 2006 at 09:34:09AM -0800, David Xu wrote: > > > > > > > > > Dear Ondrej, > > > > > > > > > > > > > > > > > > Thanks for sending the python code. Could you elaborate t= he procedures > > > > > > > > > of exporting the matrices to disk? Which libmesh function= should I > > > > > > > > > use? An example will be greatly appreciated. > > > > > > > > > > > > > > > > > > Best wishes, > > > > > > > > > > > > > > > > > > David > > > > > > > > > > > > > > > > > > On 3/1/06, Ondrej Certik <on...@ce...> wrote: > > > > > > > > > > here is the python code which solves it. you need to ex= port the matrices to > > > > > > > > > > disk from your c++ code. also extract boundary nodes. I= t gives you both > > > > > > > > > > eigenvalues and eigenvectors. > > > > > > > > > > Ondrej > > > > > > > > > > > > > > > > > > > > On Tue, Feb 28, 2006 at 11:22:21PM -0800, David Xu wrot= e: > > > > > > > > > > > Dear Ondrej, > > > > > > > > > > > > > > > > > > > > > > I read your previous emails and know you've figured o= ut a way > > > > > > > > > > > calculating the eigenvalues using pysparse. I'm new t= o libmesh and in > > > > > > > > > > > desperate need of someone enlightening me on how to u= se libmesh to > > > > > > > > > > > solve generalized eigen value problems. Would you ple= ase send me a > > > > > > > > > > > simple example of your working code? I also have a qu= estion, will > > > > > > > > > > > pysparse also solve the linear system and calculate t= he function > > > > > > > > > > > values after the eigen values are calcuated? If not, = what would you do > > > > > > > > > > > to get the eigen states that are corresponding to the= eigen values > > > > > > > > > > > calculated? > > > > > > > > > > > > > > > > > > > > > > Thanks a lot in advance! > > > > > > > > > > > > > > > > > > > > > > David > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > > that extends applications into web and mobile media. Attend the live we= bcast > > and join the prime developer group breaking into this new coding territ= ory! > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > > _______________________________________________ > > Libmesh-users mailing list > > Lib...@li... > > https://lists.sourceforge.net/lists/listinfo/libmesh-users > |