-
Notifications
You must be signed in to change notification settings - Fork 119
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
How to run SciANN on GPU #77
Comments
Tensorflow automatically defaults to GPU is available. No action is needed.On Jan 18, 2023, at 1:54 AM, Ali Dashti ***@***.***> wrote:
Dear community,
I have a trivial question: how can I run SciANN on GPU?
I want to use available GPU of google colab because I have not cuda GPU in my laptop.
Let's say the following script is what I want to run on GPU, how can I modify it to be useable on google colab?
import sciann as sn
from sciann.utils.math import diff
t_ic = 50
t_left = 70
t_right = 40
x = sn.Variable('x')
t = sn.Variable('t')
T = sn.Functional('T', [t,x], 4*[20], 'tanh')
L1 = diff(T, t, order=1) - lamda/(rho* cp)*diff(T, x, order=2)
BC_letf = (x==0.)*(T - t_right)
BC_right = (x==10.)*(T - t_right)
IC = (t==0.)*(T - t_ic)
m = sn.SciModel([x, t], [L1, BC_left, BC_right, IC])
x_data, t_data = np.meshgrid(np.linspace(0, 1, 100), np.linspace(0, 60, 100))
h = m.train([x_data, t_data], 4*['zero'], learning_rate=0.002, epochs=500)
In advance, I appreciate any hint and help.
Cheers
Ali
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@ehsanhaghighat , Thanks a lot for your help.
It is super slow in colab an maybe I have made some stupid mistakes: I copied the script into a notebook in colab and set the runtime type to GPU! |
The network and batch-size should be substantially large to leverage gpu throughput otherwise cpu is faster. Try with +10k batchsize and with a large network.On Jan 19, 2023, at 12:18 AM, Ali Dashti ***@***.***> wrote:
@ehsanhaghighat , Thanks a lot for your help.
I tried an example on both my laptop and GPU provided by google colab.
My laptop was faster. Is it something normal? I have seen your comments here.
This is configration of the model (my model is a smple 2d trasnsiet heat equation):
Total samples: 90000
Batch size: 64
Total batches: 1407
It is super slow in colab an maybe I have made some stupid mistakes: I copied the script into a notebook in colab and set the runtime type to GPU!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@ehsanhaghighat , thanks for your quick response. I tried with the following configuration but still nothing happens in colab and
If I make it bigger, colab kicks me out of the session and say I am out of RAM :-). |
Hmm, is this data-driven or pinn? And are you using high-order differentiation or 1st order only? On Jan 19, 2023, at 12:53 AM, Ali Dashti ***@***.***> wrote:
@ehsanhaghighat , thanks for your quick response. I tried with the following configuration but still nothing happens in colab and m.train() continues running:
Total samples: 90000000
Batch size: 15000
Total batches: 6000
If I make it bigger, colab kicks me out of the session and say I am out of RAM :-).
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@ehsanhaghighat, Thanks for devoting time to my problem. It is PINN and I want to solve the second order transient heat PDE in x and y directions. This is the script I am running in colab:
It runs for about 10 mins and then |
hi, do you still need help with it? I may comment in case |
Dear @sandhu-githhub , Thanks for your help. Still I need help because I could not figure it out. I very much apprecate if you let me know how I can run the code in GPU. As you see, the problem is that when I run the script in google colab it simply does not work. Sntax is here. If I reduce the |
Dear community,
I have a trivial question: how can I run SciANN on GPU?
I want to use available GPU of google colab because I have not cuda GPU in my laptop.
Let's say the following script is what I want to run on GPU, how can I modify it to be useable on google colab?
In advance, I appreciate any hint and help.
Cheers
Ali
The text was updated successfully, but these errors were encountered: