jesperschmidthansen / molsim

GNU Octave interface to seplib
Other
4 stars 2 forks source link

molsim('hello') fails #17

Closed robertf closed 5 months ago

robertf commented 9 months ago

I gave the command pkg install "https://github.com/jesperschmidthansen/molsim/archive/refs/tags/v1.0.0.tar.gz" in Octave 9.0.1. There were some warnings and possibly an error:

source/sepintgr.c: In function 'sep_langevinGJF':
source/sepintgr.c:97:24: warning: comparison of integer expressions of different signedness: 'unsig
ned int' and 'long int' [-Wsign-compare]
   97 |   for ( unsigned n=0; n<sys->npart; n++ ){
      |                        ^
C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\bin\ar.exe: creating libsep.a
molsim.c: In function 'action_get':
molsim.c:747:39: warning: passing argument 2 of 'mxCreateNumericArray' from incompatible pointer ty
pe [-Wincompatible-pointer-types]
  747 |     plhs[0] = mxCreateNumericArray(1, &nuau, mxINT32_CLASS, mxREAL);
      |                                       ^~~~~
      |                                       |
      |                                       const long int *
In file included from C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\include\octave-9.0.1\octave/mex.h:68,

                 from molsim.h:4,
                 from molsim.c:2:
C:\PROGRA~1\GNUOCT~1\OCTAVE~1.1\mingw64\include\octave-9.0.1\octave/mexproto.h:184:67: note: expect
ed 'const mwSize *' {aka 'const long long int *'} but argument is of type 'const long int *'
  184 |                                                     const mwSize *dims,
      |                                                     ~~~~~~~~~~~~~~^~~~

molsim installed - hopefully without errors
...

When I do molsim('hello') I get this error message: error: 'molsim' undefined near line 1, column 1 So I guess that last bit wasn't just a warning? Any idea what I might be doing wrong? Thanks.

jesperschmidthansen commented 9 months ago

Thanks a lot for the report! I do not think you are doing anything wrong - molsim should install as you did it.

1) The first warning is completely valid, but for some reason I do not get this with my version of gcc (12.2.0) - I will fix this! Can I ask you what version of mingw you use? The second warning is more tricky; with Octave 8.4 the type is long int (as the code uses) not const long long as your report shows. This might be an Octave issue.

2) Despite the warnings I think the build should be made. After installation does the command pkg list show molsim? Does the file 'molsim.mex' exists on you computer?

I will soon make a bug-fix release (v.1.0.1) based on your report.

Jesper

robertf commented 9 months ago
  1. I don't know offhand how to tell what version of mingw I'm using. For gcc I get this:
    PS C:\Program Files\GNU Octave\Octave-9.0.1\mingw64\bin> ./gcc -v
    Using built-in specs.
    COLLECT_GCC=C:\Program Files\GNU Octave\Octave-9.0.1\mingw64\bin\gcc.exe
    COLLECT_LTO_WRAPPER=C:/Program\ Files/GNU\ Octave/Octave-9.0.1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: /buildbot/octave-mxe-default-w64/build/tmp-native-gcc/gcc-13.2.0/configure --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --build=x86_64-pc-linux-gnu --prefix=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32 --enable-languages=c,c++,fortran --disable-libsanitizer --enable-version-specific-runtime-libs --disable-nls --without-x --disable-win32-registry --with-native-system-header-dir=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32/include --enable-threads=posix --disable-multilib --enable-64bit --disable-libgomp --with-cloog=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32 --with-gmp=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32 --with-isl=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32 --with-mpc=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32 --with-mpfr=/buildbot/octave-mxe-default-w64/build/usr/x86_64-w64-mingw32
    Thread model: posix
    Supported LTO compression algorithms: zlib
    gcc version 13.2.0 (GCC)
  2. 'pkg list' does show molsim, but I have not been able to find molsim.mex. Where should it be?
robertf commented 9 months ago

molsim is not listed in mingw64/lib/octave/packages/, where I see other packages that have .mex files.

robertf commented 9 months ago

This is different but the same: I've now installed molsim 1.0.0 in Octave 6.2.0 running under Debian Linux 11 within VirtualBox under Windows 11. The pkg install command completed without any warnings or error messages, but when I give the command molsim('hello') I again get the message error: 'molsim' undefined near line 1, column 1 I do see the file ~/octave/molsim-1.0.0/molsim.mex.

jesperschmidthansen commented 9 months ago

If you go to that directory and launch Octave from here can you shake hands?

From terminal cd ~/octave/molsim-1.0.0 octave molsim('hello')

If this works you can add the directory to your search path using

addpath('~/octave/molsim-1.0.0/')

This does not explain/fix why the standard installation did not succeed. Of that I am still not sure.

robertf commented 9 months ago

For my Linux-in-VirtualBox Octave, your suggestion works perfectly :-)

For my Windows Octave, I finally found molsim.mex and I can do

cd C:\Users\Robert\AppData\Roaming\octave\api-v58\packages\molsim-1.0.0\
& 'C:\Program Files\GNU Octave\Octave-9.0.1\mingw64\bin\octave.bat'
molsim('hello')

and it works :-) (I don't know if octave.bat is actually the file that I should run.)

In addition to using addpath, do I also use savepath so I don't have to repeat the addpath every time?

jesperschmidthansen commented 9 months ago

I tend to add paths in my octave startup file. Under linux this is is just the file ~/.octaverc . Not sure about Windows, but I think the same file should be on your (Windows) machine somewhere.

I will install Octave on a Windows machine, get the installation procedure right on this OS, update the documentation, and make a bug-fix release. Thank you once again for reporting this.

robertf commented 9 months ago

I think that the PATH is stored in the Windows registry?

jesperschmidthansen commented 5 months ago

Hi robertf,

A final comment: I can make every thing work if I load molsim explicit with the package manager

pkg load molsim

I will close the issue unless you have objections.

robertf commented 5 months ago

Doing 'pkg load molsim' also made it work for me. Thank you.

I couldn't figure out what the current version number was, for the install command, so I just used 1.0.0 again. Is that correct? Where should I look for the version number?

jesperschmidthansen commented 5 months ago

The newest version is 1.0.1 - mainly based on your comment :) The release has not yet been announced on Octave's Github page, but this will soon happen.

Out of curiosity, can I ask what systems you simulate with molsim?

robertf commented 5 months ago

Thank you.

My modelling is mainly with the finite-element method (ear mechanics and acoustics) but when teaching I like to introduce students to other modelling approaches, including molecular dynamics. I haven't yet found an excuse to use it for real.

jesperschmidthansen commented 5 months ago

Thanks. It's really good to know that you use it for teaching - very interesting. It is worth to consider some tools for nice visualization...