speepu
speepu

Reputation: 31

Tensorflow-directml vs tensorflow-CPU

I'm currently starting to study CNN in Python with Tensorflow. I do understand that Tensorflow uses CUDA, so I instead tried using Tensorflow-directml because I'm using an AMD gpu (RX 580 and I3 10100f CPU). I tried to build a basic model for an object detection using CIFAR-10 dataset with this model:

model = models.Sequential()
model.add(layers.Conv2D( 32, (3,3), activation='relu', input_shape=(32,32,3) ) )
model.add(layers.MaxPooling2D( (2,2) ))
model.add(Dropout(0.1))

model.add(layers.Conv2D( 64, (3,3), activation='relu' ) )
model.add(layers.MaxPooling2D( (2,2) ))
model.add(Dropout(0.1))

model.add(layers.Conv2D( 128, (3,3), activation='relu' ) )
model.add(layers.MaxPooling2D( (2,2) ))
model.add(Dropout(0.1))

model.add(layers.Flatten())
model.add(layers.Dense(128, activation= 'relu'))
model.add(layers.Dense(10))

Note: processed with Adam optimizer with default learning rate.

My question is not about what is the proper model, but instead why significant performance where tensorflow-CPU is performing faster than tensorflow-directml. It takes ~3 mins with my CPU for 1 epoch with 50000 training data where as directml took ~13 mins for 1 epoch with 50000 training data. What seems to cause this performance difference and on what cases should i use my GPU or CPU?

Upvotes: 2

Views: 1490

Answers (1)

koreanjohn
koreanjohn

Reputation: 21

Its probably because you have a more modern cpu than gpu. I ran a CNN on my cpu(R5 5500) and it was only a little bit slower than my gpu(Radeon RX 5600XT).

Upvotes: 2

Related Questions