Skip to content

Commit

Permalink
Merge branch 'python' into scafacos-split
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 16, 2020
2 parents 483b05f + 6666b31 commit fd86b9e
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 116 deletions.
20 changes: 10 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ clang-sanitizer:
tags:
- docker
- linux
- cuda-kepler
- cuda

cuda11-maxset:
<<: *global_job_definition
Expand Down Expand Up @@ -271,7 +271,7 @@ cuda10-maxset:
tags:
- docker
- linux
- cuda-kepler
- cuda

tutorials-samples-maxset:
<<: *global_job_definition
Expand All @@ -295,7 +295,7 @@ tutorials-samples-maxset:
tags:
- docker
- linux
- cuda-kepler
- cuda

tutorials-samples-default:
<<: *global_job_definition
Expand All @@ -318,7 +318,7 @@ tutorials-samples-default:
tags:
- docker
- linux
- cuda-kepler
- cuda
only:
- schedules

Expand All @@ -344,7 +344,7 @@ tutorials-samples-empty:
tags:
- docker
- linux
- cuda-kepler
- cuda
only:
- schedules

Expand Down Expand Up @@ -405,7 +405,7 @@ installation:
tags:
- docker
- linux
- cuda-kepler
- cuda
when: manual

empty:
Expand All @@ -425,7 +425,7 @@ empty:
tags:
- docker
- linux
- cuda-kepler
- cuda

check_sphinx:
<<: *global_job_definition
Expand All @@ -448,7 +448,7 @@ check_sphinx:
tags:
- docker
- linux
- cuda-kepler
- cuda

run_tutorials:
<<: *global_job_definition
Expand All @@ -468,7 +468,7 @@ run_tutorials:
tags:
- docker
- linux
- cuda-kepler
- cuda
only:
- schedules

Expand Down Expand Up @@ -519,7 +519,7 @@ check_with_odd_no_of_processors:
tags:
- docker
- linux
- cuda-kepler
- cuda


.deploy_base:
Expand Down
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

19 changes: 5 additions & 14 deletions maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ set_default_value() {
# handle environment variables
set_default_value srcdir "$(pwd)"
set_default_value cmake_params ""
set_default_value with_fftw true
set_default_value with_coverage false
set_default_value with_coverage_python ${with_coverage}
set_default_value with_ubsan false
Expand Down Expand Up @@ -133,12 +132,6 @@ else
cmake_params="${cmake_params} -DWITH_STOKESIAN_DYNAMICS=OFF"
fi

if [ "${with_fftw}" = true ]; then
:
else
cmake_params="-DCMAKE_DISABLE_FIND_PACKAGE_FFTW3=ON ${cmake_params}"
fi

if [ "${with_coverage}" = true ]; then
cmake_params="-DWITH_COVERAGE=ON ${cmake_params}"
fi
Expand Down Expand Up @@ -175,7 +168,7 @@ builddir="${srcdir}/build"

outp srcdir builddir \
make_check_unit_tests make_check_python make_check_tutorials make_check_samples make_check_benchmarks \
cmake_params with_fftw \
cmake_params \
with_coverage with_coverage_python \
with_ubsan with_asan \
check_odd_only \
Expand Down Expand Up @@ -285,13 +278,11 @@ if [ "${run_checks}" = true ]; then
else
start "TEST"

if [ "${HIP_PLATFORM}" != "hcc" ]; then
check_proc_particle_test=${check_procs}
if [ "${check_proc_particle_test}" -gt 4 ]; then
check_proc_particle_test=4
fi
mpiexec -n ${check_proc_particle_test} ./pypresso "${srcdir}/testsuite/python/particle.py" || exit 1
check_proc_particle_test=${check_procs}
if [ "${check_proc_particle_test}" -gt 4 ]; then
check_proc_particle_test=4
fi
mpiexec -n ${check_proc_particle_test} ./pypresso "${srcdir}/testsuite/python/particle.py" || exit 1

end "TEST"
fi
Expand Down
37 changes: 0 additions & 37 deletions maintainer/CI/build_docker.sh

This file was deleted.

9 changes: 5 additions & 4 deletions maintainer/files_with_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
git ls-files --exclude-standard |
grep -vE '\.(blk|gz|npz|data|dat|tab|chk|jpg|png|pdf|fig|gif|xcf|css|bib|vtf|vtk|svg|ico|eps|rst|ipynb)$' |
grep -vE '^testsuite/configs/|^old/|^cmake/|^libs/' |
grep -vE '(ChangeLog|AUTHORS|COPYING|NEWS|README|INSTALL)' |
grep -vE '(\.gitmodules|\.github|\.gitignore|\.codecov\.yml|\.gitlab-ci\.yml|\.travis\.yml|bors\.toml)' |
grep -vE '(\.clang-format|\.clang-tidy|\.pylintrc|tools/ubsan-suppressions\.txt)' |
grep -vE '(Doxyfile|latexmk\.1|latexmkrc|assemble_quickref\.awk|doc/misc/homepage/palette\.html)' |
grep -vE '(ChangeLog|AUTHORS|COPYING|NEWS|README|INSTALL|README\.md|CONTRIBUTING\.md)' |
grep -vE '(\.gitmodules|\.github|\.gitignore|\.codecov\.yml|\.gitlab-ci\.yml|kodiak\.toml)' |
grep -vE '(\.clang-format|\.cmake-format|\.clang-tidy|\.coveragerc|\.pylintrc|ubsan\.supp)' |
grep -vE '(\.lgtm\.yml|\.pre-commit-config\.yaml|requirements\.txt)' |
grep -vE '(Doxyfile|latexmk\.1|latexmkrc|assemble_quickref\.awk)' |
grep -vE '(src/config/features\.def)' |
grep -vE '(featurelist)' |
grep -vE '(\.cproject|\.project|\.settings)'
74 changes: 39 additions & 35 deletions src/python/espressomd/visualization_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,10 @@ def __init__(self, system, **kwargs):
self.system = system
self.system_info = {}

self.last_T = -1
self.last_box_l = self.system.box_l
self.fps_last = 0
self.fps = 0
self.fps_count = 0
self.fps_count = 1

self.glut_main_loop_started = False
self.screenshot_initialized = False
Expand All @@ -447,10 +446,9 @@ def __init__(self, system, **kwargs):
self.timers = []
self.particles = {}

self.update_elapsed = 0
self.update_timer = 0
self.draw_elapsed = 0
self.draw_timer = 0
# times of last call of update(), redraw_on_idle()
self.last_update = time.time()
self.last_draw = time.time()

self.trigger_set_particle_drag = False
self.trigger_reset_particle_drag = False
Expand Down Expand Up @@ -594,18 +592,19 @@ def run(self, integration_steps=1):

def main():
while True:

self.update()

if self.paused:
time.sleep(0.0001) # sleep(0) is worse
else:
if not self.paused:
try:
self.system.integrator.run(integration_steps)
except Exception as e:
print(e)
os._exit(1)

# Necessary to regularly drop the Global Interpreter Lock (GIL)
# which prevents freezing of the visualizer under certain
# circumstances (see Issue #3764).
time.sleep(1e-12)

t = Thread(target=main)
t.daemon = True
t.start()
Expand Down Expand Up @@ -639,32 +638,28 @@ def update(self):
self.hasParticleData = True

# UPDATES
self.update_elapsed += (time.time() - self.update_timer)
if self.update_elapsed > 1.0 / self.specs['update_fps']:
self.update_elapsed = 0

if (time.time() - self.last_update) > 1.0 / \
self.specs['update_fps']:
# ES UPDATES WHEN SYSTEM HAS PROPAGATED. ALSO UPDATE ON PAUSE
# FOR PARTICLE INFO
if self.paused or not self.last_T == self.system.time:
self.last_T = self.system.time
self._update_particles()
self._update_particles()

# LB UPDATE
if self.specs['LB_draw_velocity_plane']:
self._update_lb_velocity_plane()
# LB UPDATE
if self.specs['LB_draw_velocity_plane']:
self._update_lb_velocity_plane()

# BOX_L CHANGED
if not (self.last_box_l == self.system.box_l).all():
self.last_box_l = np.copy(self.system.box_l)
self._box_size_dependence()
# BOX_L CHANGED
if not (self.last_box_l == self.system.box_l).all():
self.last_box_l = np.copy(self.system.box_l)
self._box_size_dependence()

# KEYBOARD CALLBACKS MAY CHANGE ESPRESSO SYSTEM PROPERTIES,
# ONLY SAVE TO CHANGE HERE
for c in self.keyboard_manager.userCallbackStack:
c()
self.keyboard_manager.userCallbackStack = []

self.update_timer = time.time()
self.last_update = time.time()

# DRAG PARTICLES
if self.specs['drag_enabled']:
Expand Down Expand Up @@ -1400,11 +1395,9 @@ def motion(x, y):

def redraw_on_idle():
# DON'T REPOST FASTER THAN 60 FPS
self.draw_elapsed += (time.time() - self.draw_timer)
if self.draw_elapsed > 1.0 / 60.0:
self.draw_elapsed = 0
if (time.time() - self.last_draw) > 1.0 / 60.0:
OpenGL.GLUT.glutPostRedisplay()
self.draw_timer = time.time()
self.last_draw = time.time()
return

def reshape_callback(w, h):
Expand All @@ -1426,6 +1419,19 @@ def close_window():
OpenGL.GLUT.glutIdleFunc(redraw_on_idle)

def _init_timers(self):
"""
Starts infinite loops of timed function callbacks.
Using `OpenGL.GLUT.glutTimerFunc()` a timed function callback is
registered that after (at least) the specified time calls a
specific function, which re-registers a timed callback to itself
plus does some other stuff.
Per callback registered in `self.timers`, one such infinite
callback loop is started.
In addition, potential keyboard input is handled every (at least)
17 ms, corresponding to a rate of ~60 1/s.
"""

# TIMERS FOR register_callback
def dummy_timer(index):
Expand All @@ -1435,10 +1441,8 @@ def dummy_timer(index):
dummy_timer,
index)

index = 0
for t in self.timers:
OpenGL.GLUT.glutTimerFunc(t[0], dummy_timer, index)
index += 1
for index, timer in enumerate(self.timers):
OpenGL.GLUT.glutTimerFunc(timer[0], dummy_timer, index)

# HANDLE INPUT WITH 60FPS
# pylint: disable=unused-argument
Expand Down Expand Up @@ -1530,7 +1534,7 @@ def _reset_particle_drag(self, pos, pos_old):
if self.drag_id != -1:
self.trigger_reset_particle_drag = True

def _get_particle_info(self, pos):
def _get_particle_info(self, pos, pos_old):
part_id, _ = self._get_particle_id(pos)
if self.show_system_info:
self.show_system_info = False
Expand Down
Loading

0 comments on commit fd86b9e

Please sign in to comment.