shankar1729 / jdftx

JDFTx: software for joint density functional theory
http://jdftx.org
82 stars 54 forks source link

Octave crashes when doing createVASP #22

Closed ximik69 closed 6 years ago

ximik69 commented 6 years ago

Hi dear Shankar, I've found another trouble - Octave crashes when doing createVASP.

[user@localhost ecut30]$ createVASP X.out X.vasp X.n 5 terminate called after throwing an instance of 'octave::exit_exception' panic: Aborted -- stopping myself... attempting to save variables to 'octave-workspace'... save to 'octave-workspace' complete octave exited with signal 6

The same trouble is with scale factor 1.

Version: [user@localhost ecut30]$ octave --version GNU Octave, version 4.2.1 Copyright (C) 2017 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Octave was configured for "x86_64-mageia-linux-gnu".

It creates vasp file but it is truncated: [user@localhost ecut30]$ bader X.vasp

GRID BASED BADER ANALYSIS (Version 1.03 11/13/17)

OPEN ... X.vasp
VASP4-STYLE INPUT FILE At line 89 of file chgcar_mod.f90 (unit = 100, file = 'X.vasp') Fortran runtime error: End of file

Where can I look in order to give you more info?

Best wishes, Igor

ximik69 commented 6 years ago

Hi dear Shankar,

I've checked createVASP on my old laptop with mga4 distro. It works but partially. If size of vasp file is bigger than approx. 1.4G(needs to be tested more), bader complains for end of file, like in previous post.

Octave version on mga4 is 3.6.4. Both distros mageia 4 and 6 are 64bit, octave and bader programs too.

bader complaints for end of file, look like in http://theory.cm.utexas.edu/henkelman/forum/viewtopic.php?f=1&t=3315

but no ulimits for RAM and file sizes, 64bit executables. I'll continue search.

Best, Igor.

shankar1729 commented 6 years ago

Hi Igor,

This might be a bader issue based on that post. Can you check if similarly large CHGCAR files output from VASP have the same issue? (If you have access to VASP.)

Shankar

ximik69 commented 6 years ago

Dear Shankar,

unfortunately I don't have access to VASP.

As for me it seems to be two different problems - with bader and with octave.

I'll test another builds of bader with other toolchains (even gcc7.2.0+musl-libc).

Also I have tried again to run createVASP X.out X.vasp X.n 3 on my new laptop(mga6, octave 4.2.1). It crashed again with the same message as in the first post, but produced quite reasonable file. Please don't ask me why did it work. I have totally no idea. I think I need to test several versions of octave in order to have any ideas.

ximik69 commented 6 years ago

Do you know any easy way to obtain configuration options of octave? Maybe they will give some useful info.

And is it good idea to make symlink called octave, pointing to matlab on cluster? They don't have octave, but have matlab. Will your scripts work? I can ask admins to install octave, but I don't know appropriate version.

With best wishes, Igor.

shankar1729 commented 6 years ago

I have not tested scripts on matlab. Octave supports most matlab syntax, but the reverse is not true. It shoudl be possible to adapt the scripts for matlab fairly easily (eg. switch comment character from # to %, swap string quotes from double to single etc.), but it will likely not work out of the box in matlab.

Best, Shankar

ximik69 commented 6 years ago

Dear Shankar, thanks a lot for making things clear.

I'll experiment more and post the results later, as now I will be very busy for quite a long time.

Best wishes, Igor.

ximik69 commented 6 years ago

Hello dear Shankar, I have checked my octave - it has only 32bit indices. How to prove it - run:

x = eye (65536,65536,'int8');

if you see error: out of memory or dimension too large for Octave's index type

That's could be the problem. But is it? One need to experiment more.

Thus I've tried building octave using MXE, see instruction http://wiki.octave.org/MXE

I used section "Compiling for your Linux system". pkg-config and OpenSSL builds failed. No idea why it was with pkg-config, but fail with OpenSSL was fatal. Possibly due to wrong version: my is 1.0.2o, required ≥ 1.01 (prereqs are here http://mxe.cc/#requirements), but 1.0.2o>1.0.1 and there no other similarly looking versions.

My distro has only the version 1.0.2o. I'll see if distro update will help... No it doesn't.

Yeah I was warned by authors:)) For systems that provide packages of recent versions of GCC and required build dependencies, MXE-Octave is NOT the best choice for building Octave. But I want octave with 64bit indices.

Well, there are other options

ximik69 commented 6 years ago

For instance these: http://calaba.tumblr.com/post/107087607479/octave-64 https://github.com/calaba/octave-3.8.2-enable-64-ubuntu-14.04

I think "the lazy solution" is worthwhile to try: http://calaba.tumblr.com/post/107087607479/octave-64#solution_lazy Small upd. VM image doesn't exist.

The install scripts are for Ubuntu, but the only significant difference I see , is in installing packages with apt-get. I'll see whether this will work after some editing.

I'll see whether createVASP will crash Octave with 64bit indices.

Best wishes, Igor.

ximik69 commented 6 years ago

Ok, I've managed to build and install octave from this receipt https://github.com/calaba/octave-3.8.2-enable-64-ubuntu-14.04

I installed almost all prereqs, and adapted scripts a bit(different source and installation dirs, all apt-get commands commented).

It runs. But make test lead to crash.

running createVASP X.out X.vasp X.n 4 emits: Sshift =

terminate called after throwing an instance of 'octave::exit_exception' panic: Aborted -- stopping myself... attempting to save variables to 'octave-workspace'... save to 'octave-workspace' complete octave exited with signal 6

testing with scaling 1-5 gives the same but vasp file looks intact. It can be opened by VESTA w/o errors.

The program bader, I used before, was built on mga4 distro and then just binary was copied. Rebuilding it on mga6 seems to eliminate the problem with At line 89 of file chgcar_mod.f90 (unit = 100, file = 'X.vasp') Fortran runtime error: End of file

But this needs more thorough testing.

That new build of octave works with createXSF both with electronic density and 1 frame of animated.

shankar1729 commented 6 years ago

Hi Igor,

Thank you for trying out all these options to make it work! It may actually make sense to just translate the functionality out of octave to make this work. One possibility could be to translate the octave portion of the createVASP bash script to python/numpy instead; that shouldn't be too complicated overall.

Best, Shankar

ximik69 commented 6 years ago

Hi Shankar, thanks for your suggestions.

As a conclusion we had two problems: octave crash and bader error.

The second problem disappeared after rebuild with newer compiler. By the way both binaries are static, thus no troubles of missing/wrong/incompatible ABI deps. Only compiler/flags could be the reason. Now I see it's over.

Octave 3.6.4(mga4 distro) seems to work, 4.2.1(mga6) and 3.8.2 (self built https://github.com/calaba/octave-3.8.2-enable-64-ubuntu-14.04) crash, but seem to produce good files.

ximik69 commented 6 years ago

I've found that this is bug in octave:

https://savannah.gnu.org/bugs/?49271 https://stackoverflow.com/questions/45362265/abnormal-termination-of-gnu-octave-script

It is corrected in v.4.3.0.

Let's run test.m

x=5 exit(0)

v.4.2.1 mga6

[user@localhost ~]$ /usr/bin/octave ./test.m warning: function ./test.m shadows a core library function x = 5 terminate called after throwing an instance of 'octave::exit_exception' panic: Aborted -- stopping myself... attempting to save variables to 'octave-workspace'... save to 'octave-workspace' complete octave exited with signal 6

v.3.8.2 no crash at test, but crash at work

/src/octave/bin/octave ./test.m warning: function ./test.m shadows a core library function GNU Octave, version 3.8.2 Copyright (C) 2014 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.

Octave was configured for "x86_64-unknown-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful. For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports. For information about changes from previous versions, type 'news'.

x = 5

It crashes due to exit(0) function:)And not in all the cases.

I just commented out exit(0) at line 188 in createVASP and it solved problem for v.3.8.2.

Thus crash is not a problem, you don't need to rewrite createVASP.

The problem seems to be solved. And I now managed to install lssa package from octave-forge on octave v.3.8.2, which I couldn't do with v.4.2.1 from distro.

By the way, does Fourier interpolation of charge densities provide the same accuracy as direct calculation of them somewhere in dump command in jdftx?

Best wishes, Igor.