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

using GPU #6

Open
chayan18 opened this issue Sep 23, 2019 · 4 comments
Open

using GPU #6

chayan18 opened this issue Sep 23, 2019 · 4 comments

Comments

@chayan18
Copy link

Hi, please let me know what are the modifications required to run these code on GPU server.

@befelix
Copy link
Owner

befelix commented Sep 23, 2019

This being tensorflow code there shouldn't be any major obstacles to running this on the GPU. However, I haven't really tested this.

That being said, this code depends on an old version of tensorflow and I would probably recommend porting this to newer versions of tensorflow and making use of keras.

@chayan18
Copy link
Author

chayan18 commented Sep 24, 2019

Hi, thanks for your response.

I have these additional questions too.
3

  1. Could you please be explicit what are these instructions given?

  2. My CPU system has 12 cores and 2 sockets, replacing num_cores =12 and num_sockets=2 does make any difference?

  3. If I am using GPU server do I need to make any modifications here?

@befelix
Copy link
Owner

befelix commented Sep 24, 2019

@spenrich Could you comment on this?

@spenrich
Copy link
Contributor

spenrich commented Sep 24, 2019

@chayan18

  1. For the options:
  • np_dtype is used to specify the datatype for all numpy arrays to avoid such errors as trying to add two arrays of incompatible dtype (see __init__.py and configuration.py in the source code)
  • tf_dtype is similar and should be the TensorFlow counterpart to np_dtype
  • eps is a numerical tolerance used to ensure each layer weight matrix of the Lyapunov neural network is positive definite (see eq. (2) and surrounding text in the paper)
  • saturate specifies whether or not saturation constraints should be applied to the fixed policy (see the cell below the title "Fixed Policy" in the example)
  • use_zero_threshold specifies whether or not to consider the additional discretization term with tau in the Lyapunov decrease condition (see "Practical Considerations" on pg. 8 in the paper). If you just want to try the method out on your system without worrying about this extra term, setting this to True assumes a "very fine" discretization.
  • pre_train specifies whether or not to pre-train the Lyapunov neural network to match some other specified Lyapunov function with supervised training. The idea is that you can use this to "initialize" the Lyapunov neural network to match, e.g., a typical quadratic function, to ensure there is an initial safe set and then apply the algorithm from there
  • dpi just sets the DPI for matplotlib figures
  • num_cores and num_sockets come from the performance guide on the TensorFlow website (see the sections "Optimizing for CPU" and "Tuning MKL for the best performance" in the link). These options assume you have compiled TensorFlow from source for your machine, so as long as you've done that your settings should make a difference.
  • tf_checkpoint_path should specify a directory where TensorFlow checkpoints or "save points" of your session can be saved (see the cells titled "Neural Network Training" and "Initialization", and the TensorFlow docs). This is useful for prototyping different changes in your code, and even changing settings in the middle of training to see the effect they have.
  1. See comment above for num_cores and num_sockets.

  2. All of these settings are related to the CPU, so they should not affect any GPU settings. I have not tried running any of this on a GPU, so I would have to defer to the TensorFlow documentation for any specifics.

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

No branches or pull requests

3 participants