The meep module seems to be installed in the system folder /opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/meep/ but the runtime error is in simulation.py is from your local directory in /home1/07449/pf04620/bend_flux/meep/. Perhaps there are two different (and conflicting) PyMeep versions installed?

Try including the line "export PYTHONPATH=/opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/" in your batch script to specify the environment variable where Python should look to find the meep module files.

PS. The meep-discuss archives are available at: https://www.mail-archive.com/meep-discuss@ab-initio.mit.edu/.


On 8/20/20 13:23, Patrick Flanigan wrote:
(I apologize if this has already been asked; for some reason I can't access the discussion archives at http://ab-initio.mit.edu/pipermail/meep-discuss/ at the moment).

I'm trying to run Python-based MEEP codes on the Stampede2 cluster (https://portal.tacc.utexas.edu/user-guides/stampede2). I'm actually dealing with a lot of errors, but to keep things simple for my first post I'll just ask one question. Since I know the sample codes on the GitHub repository work, I've been trying to run them on the cluster before I use my own. When I take bend-flux.py (https://github.com/NanoComp/meep/blob/master/python/examples/bend-flux.py) and run it locally on my own Ubuntu terminal, it works fine and gives the expected output. However, when I try to run it as batch job, I get this error message

    Traceback (most recent call last):
      File "bend_flux.py", line 54, in <module>
    sim.run(until_after_sources=mp.stop_when_fields_decayed(50,mp.Ez,pt,1e-3))
      File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
    2231, in run
        self._run_sources_until(until_after_sources, step_funcs)
      File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
    1519, in _run_sources_until
        self._run_until(new_conds, step_funcs)
      File "/home1/07449/pf04620/bend_flux/meep/simulation.py", line
    1495, in _run_until
        self.progress.value = t0 + stop_time
    UnboundLocalError: local variable 't0' referenced before assignment


This is the batch script that I've been using (it took a lot of help from other more experienced users) :

    #!/bin/bash
    #SBATCH -J bend_flux
    #SBATCH -o bend_flux_out.txt
    #SBATCH -e bend_flux_err.txt
    #SBATCH -n 1
    #SBATCH -N 1
    #SBATCH -p development
    #SBATCH -t 0:10:00

    module load python3
    module load meep

    ln -sf
    /opt/apps/intel18/impi18_0/meep/1.12.0/lib/python3.7/site-packages/meep/
    ./

    ibrun -np 1 python3 bend_flux.py > bend_flux_run.txt


(I just changed the - to _ in the file name because I thought it would help avoid errors; I don't think that's the problem). I don't fully understand it, but I think that the ln -sf line puts all the MEEP files in the folder where the batch script is, but there's some sort of problem with reading those files. Could it be because the cluster is using an older version of MEEP, and this bug is fixed in more recent versions? Or is this something I need to manually change in the simulation.py file?

Any help would be greatly appreciated.
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to