![]() Use the following to do the same operation on the CPU: This will use the CPU with a matrix of size 1500 squared. You can run this at the command line with: Print("Time taken:", datetime.now() - startTime) Print("Shape:", shape, "Device:", device_name) # It can be hard to see the results on the terminal with lots of output - add some newlines to improve readability. ![]() With tf.Session(config=tf.ConfigProto(log_device_placement=True)) as session: Sum_operation = tf.reduce_sum(dot_operation) Random_matrix = tf.random_uniform(shape=shape, minval=0, maxval=1)ĭot_operation = tf.matmul(random_matrix, tf.transpose(random_matrix)) We can either run the code on a CPU or GPU using command line options: import sysĭevice_name = sys.argv # Choose device from cmd line. The below code creates a random matrix with a size given at the command line. This new line will create a new context manager, telling TensorFlow to perform those actions on the GPU. ![]() The main reason is that, at the time of writing (July 2016), CUDA has not yet been built for the most recent Ubuntu version, which means the process is a lot more manual. The official TensorFlow documentation outline this step by step, but I recommended this tutorial if you are trying to setup a recent Ubuntu install. ![]() Online graph builder tensorflow install#However, before you install TensorFlow into this environment, you need to setup your computer to be GPU enabled with CUDA and CuDNN. The main difference between this, and what we did in Lesson 1, is that you need the GPU enabled version of TensorFlow for your system. Head to the official TensorFlow installation instructions, and follow the Anaconda Installation instructions. I recommend that you create a new Anaconda environment for this, rather than try to update your previous one. Our instructions in Lesson 1 don’t say to, so if you didn’t go out of your way to enable GPU support than you didn’t. If you didn’t install the GPU-enabled TensorFlow earlier then we need to do that first. * Note: not really a supercomputer, but somewhat similar in many respects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |