Exemplo n.º 1
0
def run_worker_process():
    try:
        lm.init('user::default', {})
        lm.info()
        lm.log.setSeverity(1000)
        lm.log.log(lm.log.LogLevel.Err, lm.log.LogLevel.Info, '', 0, 'pid={}'.format(os.getpid()))
        lm.dist.worker.init('dist::worker::default', {
            'name': uuid.uuid4().hex,
            'address': 'localhost',
            'port': 5000,
            'numThreads': 1
        })
        lm.dist.worker.run()
        lm.dist.shutdown()
        lm.shutdown()
    except Exception:
        tr = traceback.print_exc()
        lm.log.log(lm.log.LogLevel.Err, lm.log.LogLevel.Info, '', 0, str(tr))
Exemplo n.º 2
0
# + {"nbsphinx": "hidden"}
if not lm.Release:
    lm.debug.attach_to_debugger()

# + {"raw_mimetype": "text/restructuredtext", "active": ""}
# Lightmetrica offers an extension for the Jupyter notebook to support logging or interactive progress reporting inside the notebook. The extension can be loaded by a line magic command as below.
# -

# %load_ext lightmetrica_jupyter

# + {"raw_mimetype": "text/restructuredtext", "active": ""}
# After importing the module, you can initialize the framwork by calling :cpp:func:`lm::init` function. You can pass various arguments to configure the framework to the function, but here we keep it empty so that everything is configured to be default.
# -

lm.init()

# + {"raw_mimetype": "text/restructuredtext", "active": ""}
# Logging and progress reporting in Jupyter notebook can be enabled by :cpp:func:`lm::log::init` and :cpp:func:`lm::progress::init` functions with corresponding types.
# -

lm.log.init('jupyter')
lm.progress.init('jupyter')

# + {"raw_mimetype": "text/restructuredtext", "active": ""}
# Once the framework has been initialized properly, you can get an splash message using :cpp:func:`lm::info()` function.
# -

lm.info()

# + {"raw_mimetype": "text/restructuredtext", "active": ""}
Exemplo n.º 3
0
import os
import imageio
import pandas as pd
import numpy as np
# %matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import lmfunctest as ft
import lmscene
import lightmetrica as lm

os.getpid()

# %load_ext lightmetrica_jupyter

lm.init('user::default', {})
lm.parallel.init('parallel::openmp', {'numThreads': -1})
lm.log.init('logger::jupyter', {})
lm.info()

scenes = lmscene.scenes_small()

rmse_series = pd.Series(index=scenes)
for scene in scenes:
    print("Testing [scene='{}']".format(scene))

    lm.reset()

    lm.asset('film_output', 'film::bitmap', {'w': 1920, 'h': 1080})

    # Load scene and render
Exemplo n.º 4
0
import os
import imageio
import pandas as pd
import numpy as np
import timeit
# %matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import lmfunctest as ft
import lmscene
import lightmetrica as lm

# %load_ext lightmetrica_jupyter

lm.init('user::default', {
    'numThreads': -1,
    'logger': 'logger::jupyter'
})

lm.asset('camera_main', 'camera::pinhole', {
    'position': [5.101118, 1.083746, -2.756308],
    'center': [4.167568, 1.078925, -2.397892],
    'up': [0,1,0],
    'vfov': 43.001194
})
lm.asset('obj_base_mat', 'material::diffuse', {
    'Kd': [.8,.2,.2]
})
lm.asset('model_obj', 'model::wavefrontobj', {
    'path': os.path.join(ft.env.scene_path, 'fireplace_room/fireplace_room.obj'),
    'base_material': lm.asset('obj_base_mat')
})