Hi!
I’m comparing the performance when using lightning.qubit(diff_method = ‘adjoint’)
on CPU(Intel Xeon W-2245 CPU @3.90 GHz) and on GPU(NVIDIA GeForce RTX 2080 Ti ). I’m trying to train a hybrid QNN for 100 epochs. I run on two environments: one, using tensorflow, and the other using tensorflow-gpu.
On CPU,
batch_size = 4 takes ~300s per epoch.
batch_size = 64 takes ~247s per epoch.
On GPU,
batch_size = 4 takes ~268s per epoch.
batch_size = 64 takes ~254s per epoch.
batch_size = 2000 takes ~272s per epoch.
I’m wondering why CPU is faster than the GPU?
Also, GPU utilization only goes as high as 3-5% (10417MiB / 11019MiB) despite increasing the batch size to 1024. Is it no longer possible to speed training up by utilizing GPU up to 60% or more?
A summary of my untrained model looks like this…
Model: “sequential_1”
=================================================================
sequential (Sequential) (None, 24) 14232
dense_1 (Dense) (None, 10) 250
keras_layer (KerasLayer) (None, 10) 0 (unused)
dense_2 (Dense) (None, 24) 264
=================================================================
Total params: 14,746
Trainable params: 14,746
Non-trainable params: 0
The QNN keraslayer contains IQPEmbedding and StronglyEntanglingLayers,
and it should have 90 parameters after training.
Please shed some light to this. Thank you.