FilipDominec / python-meep-install

Robust compilation procedure of latest MEEP and python-meep on Linux
GNU General Public License v2.0
16 stars 19 forks source link

no module named meep #5

Closed yandahman closed 7 years ago

yandahman commented 7 years ago

Hi

after running the install command and trying to run the waveguide sample python throws an error saying "no module named meep". Python finds the meep_mpi module but can't find the meep module. Any reason for this? Also when I try and run the straight waveguide sample using meep_mpi instead I get an error "MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode 1", so I can't run it using meep_mpi. Meep_mpi works though when I run the python script from "http://photonics.intec.ugent.be/download/pub_2579.pdf" Running on ubuntu 14.04. Thanks

Best Yanni

FilipDominec commented 7 years ago

Hi, the first issue is expected, the installer uses the MPI version by default, so you have to import 'python_meep'. I cannot tell what is the cause of the second issue, and I would be thankful if you made a little search for the piece of the python code that makes MPI crash.

yandahman commented 7 years ago

Hi, thanks for responding so soon. So I tried changing the import call to "from python_meep import *" but I still get the same error as "ImportError: no module name python_meep". I'll try looking into why the MPI is crashing as well.

FilipDominec commented 7 years ago

This is weird, because you have already observed that python could import python_meep. Are you sure you are not mixing python 2 and 3? Modules are installed for both versions independently.

yandahman commented 7 years ago

My python can import meep_mpi not meep or python-meep. I'm also running python 2.7, so I don't think it's a version thing. Maybe the installer didn't install the meep module (the non-mpi one)?

FilipDominec commented 7 years ago

I am sorry, I meant 'meep_mpi'. There is no module named 'python_meep'. I think this is settled. But we should examine what is the problem with MPI crashing...

yandahman commented 7 years ago

So then this install doesn't install the meep module (the non-mpi one) it only installs the meep_mpi module?

yandahman commented 7 years ago

I have some suspicion that running on meep_mpi will crash due to a lack of open cpu resources--currently other users are taking up most of the cpu power. I'm going to try and look into this

yandahman commented 7 years ago

Actually the error is not due to cpu usage. It crashes after saying "meep: thermo_energy_in_box no longer supported". It crashes somewhere in 'runUntilFieldsDecayed(noBendField, noBendVol, srcComp, noBendProbingpoint, pStepCallba ck = myCustomOutput)'.

FilipDominec commented 7 years ago

The module installs 'meep_mpi' by default, but you can change this simply by uncommenting the line ''MPI="serial".

I would be surprised if 100% CPU utilisation made MPI crash. Actually there seems to be no error in the installation nor in MPI; the script just tries to use a function that is not supported in the new version of meep.

yandahman commented 7 years ago

Which function is that? the runUntilFieldsDecayed? If so what should be changed to make the script run? The script I'm running is the ported over to python tutorial for the straight waveguide simulation on the meep website.

yandahman commented 7 years ago

Ok I see where it's aborting. It's in this line of code: double fields::thermo_energy_in_box(const volume &where) { long double sum = 0.0; (void) where; // unused abort("thermo_energy_in_box no longer supported"); return sum_to_all(sum); }

But I don't easily see how to fix this. Is there a way to force meep not to use thermo_energy_in_box?

yandahman commented 7 years ago

Figured out which line it was. In the outputHdf5 function it calls the following

master_printf("Total energy in volume at step %i : %f \n" %(self.stepsCount, self.pField.total_energy()))

pField.total_energy() calls thermo_energy_in_box which is deprecated and calls an abort. Maybe thermo_energy_in_box should be removed? Anyways thanks

Best Yanni

FilipDominec commented 7 years ago

Just as a closing note, thermo_energy_in_box appears indeed to be obsolete, but the change should be made not in the python-meep installer, nor in the python-meep scripts, nor even in the python-meep module, but in the meep library. The python interface will update automatically, being autogenerated by SWIG. Thank you for reporting this, though. Filip