Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[export] Support exporting custom config variables #1893

Merged
merged 5 commits into from
Sep 26, 2020

Conversation

archibate
Copy link
Collaborator

Related issue = #394

[Click here for the format server]


This would allows user to specify configuration direct-in-place in Python.
I need this for TaichiHub, an online playground, for customizable particle numbers & screen size.
Please merge this soon, idealy before next release.

Copy link
Contributor

@Hanke98 Hanke98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yubin, I think it's a really good idea to log some custom configurations and most of your code LGTM.

When I was testing the code, I wrote a simple test script:
`
import taichi as ti
ti.start_recording('test_record.yml')
ti.init(arch=ti.cc)
ti.record_action_config('num_particles', 8192)
n_particles = 8192

x = ti.Vector.field(2, float, n_particles)

@ti.kernel
def init():
for i in range(n_particles):
x[i] = [ti.random() * 0.4 + 0.2, ti.random() * 0.4 + 0.2]

init()
ti.stop_recording()
`

And I got:

[I 09/26/20 11:51:25.204] [action_recorder.cpp:start_recording@27] ActionRecorder: start recording to [test_record.yml]
[Taichi] Starting on arch=cc
Traceback (most recent call last):
File "test_record.py", line 4, in
ti.record_action_config('num_particles', 8192)
File "/home/ljf/playground/taichi/python/taichi/core/record.py", line 16, in record_action_config
record_action_entry('config', {'key': key, 'value': value})
File "/home/ljf/playground/taichi/python/taichi/core/record.py", line 6, in record_action_entry
ti_core.record_action_entry(name, list(contents.items()))
RuntimeError: Unexpected index

So, could you please have a look at that? Thank you very much!

taichi/python/export_lang.cpp Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 26, 2020

Codecov Report

Merging #1893 into master will decrease coverage by 0.07%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1893      +/-   ##
==========================================
- Coverage   43.81%   43.73%   -0.08%     
==========================================
  Files          45       45              
  Lines        6174     6185      +11     
  Branches     1097     1099       +2     
==========================================
  Hits         2705     2705              
- Misses       3300     3311      +11     
  Partials      169      169              
Impacted Files Coverage Δ
python/taichi/cc_compose.py 0.00% <0.00%> (ø)
python/taichi/core/record.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ac1a54...ec6ad29. Read the comment docs.

@archibate archibate requested a review from Hanke98 September 26, 2020 13:59
Copy link
Contributor

@Hanke98 Hanke98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks again! Learnt a lot from your code!

@Hanke98 Hanke98 merged commit d266c0f into taichi-dev:master Sep 26, 2020
@yuanming-hu yuanming-hu mentioned this pull request Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants