Faster Solidworks Renders and Citizen Science

Sophia Davis
13 min readMar 22, 2020

--

I’ll continue to update this with clarifications and resources as I think of ways to make the process even easier.

Have you ever tried to render something on a uni computer, only to find that the render time is forever and a day and the remote connection isn’t dependable? Especially now that we are all at away from uni due to COVID-19, the campus VPN is oversubscribed and most of us don’t have computers that can efficiently render all of our Visualize animations.

This is why using a GPU virtual machine can be really helpful. From even a crappy old laptop, you can remotely connect to a virtual machine hosted somewhere else that can run Solidworks and render animations and images in Visualize super freaking fast. Being able to do a GPU render can cut down the render time so much in comparison to a CPU render; I’ll talk more about this later with my example of a 7 hr uni computer CPU render that was cut down to 17 minutes with the GPU setup. But, how much does this cost? There has to be a catch!

The GPU Virtual Machines I have been using are hosted using Microsoft Azure, which is a cloud computing service created by Microsoft. Luckily for me and all of you, a lot of what we can do with it is for free thanks to a student sponsorship programme that Microsoft offers.

As a student, you are given $100 worth of Azure credit for free, without having to connect a credit card or anything (which is a relief, because otherwise it would feel sorta sketch). The Virtual Machine (VM) we are using will cost approximately $1 of this credit per hour that you use it.

However, outside of just being able to reliably and quickly render our inhaler project animations for uni, there are other real-world citizen science (protein folding!) applications for these GPU virtual machines that could potentially even help with the current COVID-19 crisis.

This is a guide to set up an Azure GPU Virtual Machine to use with Solidworks Visualize and a citizen science project called Folding@Home. It is split into three parts, the first being to set up the GPU virtual machine, the second part is to use Solidworks in it, and the final part is using the VM for citizen science after all of our CAD assignments are done.

Some important warnings: This guide looks really long but it’s just because I would always rather over-explain than under-explain. It’s actually quite simple and you could get through it quite fast if it wasn’t for the waiting times between steps. If you scroll through this guide, you may see that there is a small amount of code that you must input into a terminal. If you feel that you dislike code, please do not fear. Literally all you have to do is copy-paste it. If you follow this guide exactly, the number of problems you’ll run into should be quite minimal — I’ve made a lot of the mistakes for you, haha.

Part 1: Set up the Azure GPU Virtual Machine

This may look like a lot of steps, but in reality, it shouldn’t take much longer than 30 minutes to an hour, depending on how much time it takes for things to deploy and load. Most of your time will be spent waiting for stuff.

1. Make a student account on Azure using your Glasgow Uni credentials:

Press “Activate Now” on the page linked above.

For reference, you can check your Microsoft Azure sponsorship credit balance here: https://www.microsoftazuresponsorships.com/Balance

2. Create a virtual machine. In the dashboard, navigate to Virtual Machines and press “Add”.

Use the following settings.

Under “Basics”

Subscription: Azure For Students

Resource Group: Create a new resource group and name it whatever you’d like.

Virtual Machine Name: Name your VM whatever you’d like.

Region: Anywhere that has the NV6 VM available. Sometimes a lot of the VMs are greyed out. West Europe worked last time I checked, and East US is what I used when I set up my VM. However, there may be trial and error with selecting regions then going through the VM list under “Size” to see if that region has the NV6 available.

Depending on which Region you select, a lot of the VM size options may be greyed out. However, if you can find one with the NV6_Promo option, then it’s just perfect.

Availability Options: No infrastructure Redundancy Required

Image: Windows 10 Pro, Version 1809

Azure Spot Instance: No

Size: Standard NV6_Promo (6 vcpus, 56GiB memory)

{ Standard NV6 should be alright too. Also, don’t worry about the cost saying “$799.35/month”, that is assuming a lot of continuous usage of the VM. We will be turning ours off every time we are done using it.}

Administrator Account Username & Password: Whatever you’d like them to be. Write them down so that you input them into your remote connection client.

Should look something like this, except for the resource group and virtual machine names. The Region may depend on what’s available.

Inbound Port Rules: Allow selected ports, Select inbound ports: RDP (3389)

Already have Windows 10 Enterprise License? I’m guessing this is also a “No” for y’all, but if you do then go for it, lol.

The only thing you need to have selected is the RDP option, though feel free to select anything else as well if it’s useful for you.

Under “Disks”

Make sure the OS disk is set to Standard SSD, and leave all other settings at defaults. Unless you want to mess around with stuff.

Under “Networking”

Change your Public IP so that it is Static, which will make your life a little easier when remotely connecting to it because you won’t have to type in a new IP address every time. Click on “Create New” underneath the Public IP option and change the Assignment to “Static”. Keep the SKU at “Basic”.

Leave everything else the same, if you’d like.

Don’t copy the name above, but just make sure that your IP address has a Basic SKU and a Static Assignment.

Under “Management”

The only thing here I would change is enabling Auto-Shutdown just in case. It would suck to accidentally drain all of your precious Azure credit by accidentally forgetting to stop the VM in the Azure dashboard.

I set mine to 10 AM GMT back when I was in Glasgow, then of course had to change it to 10 AM HST when I got back home. (I had initially forgotten about changing the times until I got an auto-shutdown notice at the incorrect time, haha). This is a screenshot from the one I was setting up for my sister.

I didn’t really change anything under “Advanced” or “Tags”.

Now confirm everything is correct under “Review +Create” and press Create. Wait a while for the deployment to be done.

3. While you’re waiting, make sure you have a remote desktop client on your laptop.

If you have Windows on your computer, you can just use the built-in client called Remote Desktop Connection. If you are like me and have a Mac, then get Microsoft Remote Desktop from the app store: https://apps.apple.com/us/app/microsoft-remote-desktop-10/id1295203466?mt=12

If you have Linux, then use something like Remmina. It is actually the default client in Ubuntu and apparently works quite well.

4. Once your VM has been deployed, click “Go to Resource”. Let’s see if we can connect to it.

Your VM should already be running. Click on “Connect” on the sidebar and then, assuming you are on the RDP tab, click “Download RDP File”.

On a Mac, open the Microsoft Remote Desktop application and drag this RDP file from your Downloads folder into it. A new PC with your virtual machine name should show up in the window.

On Windows and Linux, whatever client you are using should have an option somewhere to import an RDP file. So do that, maybe Google it if unsure.

Update: Here’s how you open the RDP file on Windows. And I guess you type in your admin account username above. When you are logging on to the VM, perhaps it may prompt you for your admin account password, so maybe you can skip the step of inputting your username and password ahead of time.

In Microsoft Remote Desktop on Mac, if you right-click on the new PC and select “Edit”, then under “User Account” select “Add User Account”, you can input the Admin username and password you set when you created the virtual machine. That way, it will automatically sign you in when you connect to the virtual machine. There should be options for logon settings in the Windows and Linux clients as well.

Specifically for Mac (idk about Linux and Windows, but y’all can check), I like to change some of the other settings under Edit PC as well. Under “Devices & Audio”, I usually redirect the Clipboard, Microphone, and Cameras. And under “Folders”, I select “Redirect folders” and I have one folder added to the list. This folder exists on the Desktop of my Mac and it is how I share files back and forth between the VM and my Mac. If you want to create your own such sharable folder, you can easily link to it by pressing the plus (+) icon and selecting that folder’s location on your Mac. [See update at end of this section with more specific instructions].

Now, save your edits and connect to the Virtual Machine! On Mac, just double-click the on it, for anything else there should be a button to connect.

You might get a message that looks like this, but just press continue.

There might be some things to set up for your Windows system, and it might take a while to start. But eventually, it will start and you should be connected to your brand new Windows environment!

Yours won’t look exactly like this at the start, but you will see some form of Windows environment like this.

If you were to stop by the Task Manager right now, it would probably look something like this:

You can find the Task Manager by typing it into the start menu. To get to this view of it, press on the Performance tab.

Something is missing, where is the NVIDIA Tesla GPU?

5. We have to install the NVIDIA GPU drivers onto our virtual machine.

You can “shutdown” your virtual machine from the Windows start menu in the remote desktop client first, if you’d like. Might be a good idea. However, do not press Stop and deallocate the virtual machine in the Azure dashboard, make sure to keep it running as it must be running to install the extensions.

Even if you press shutdown in the virtual machine environment, make sure the Status on the Azure portal for the VM still says Running.

To get our GPU to work, we have to use the Azure Cloud Shell in the Azure dashboard to deploy an extension that will automatically install these drivers for us on our virtual machine.

Click this button to open up the Cloud Shell.

Confirm your subscription and wait for the terminal to start. We will be using the Azure CLI, just my personal preference. If you prefer to use Powershell or something else, here’s a link with information about the extension: https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/hpccompute-gpu-windows

First, type this into the terminal, replacing RESOURCEGROUP with the whatever the hell you named your resource group for the virtual machine and VMNAME with whatever the hell you named your virtual machine. It is all one line.

az vm extension list --resource-group RESOURCEGROUP --vm-name VMNAME -o table

Since this is a new virtual machine, nothing should happen.

However, if you happen to have any extensions installed on it already, something like this plus a list of extensions will show up. Otherwise, nothing will show up and that is fine.

If the NVIDIA extension doesn’t appear, that means it isn’t there and we should go ahead with installing it.

So type this into the terminal, again replacing the necessary placeholders RESOURCEGROUP and VMNAME. Type everything else exactly as it is, and note that this should all be on one line.

az vm extension set --resource-group RESOURCEGROUP --vm-name VMNAME --name NvidiaGpuDriverWindows --publisher Microsoft.HpcCompute --version 1.2 --settings '{}'

It will start Running and doing stuff, just wait for it. At the end, it should return some information. Just to make sure everything is good, run this again:

az vm extension list --resource-group RESOURCEGROUP --vm-name VMNAME -o table

Now it should return something that looks like this:

Awesome, now if we connect to our virtual machine again through the remote desktop client, wait for it to start up, and then open up the Task Manager…

There should be an option for the GPU and when you click on it, you should be able to see something like this! Our NVIDIA drivers have been installed and our NVIDIA Tesla GPU is working its magic. :)

6. Just so you know

How to stop the virtual machine when you’re not using it and save your precious credits:

Do not just press shutdown on the start menu.

It’s a good thing to do, but there’s still something else you must do afterwards…Make sure to press stop in the Azure portal.

Even if you pressed “shut down” in the remote desktop, the VM Status is still “Running”. That’s why you must also press Stop.

In my experience, it can take about 15 min to fully stop and deallocate. After it is properly stopped, it will no longer eat up more of your $100 student credit.

How to start it back up again:

As you can see here, the virtual machine is completely stopped and deallocated.

Press Start, wait for the VM Status to say “Running” again, then connect to it using your Remote Desktop client. :)

Update: How to add a shared folder between the VM and your Mac:

So on a Mac, after you right-click on the VM and press edit, a menu will come up with four different tabs. Under the tab that says “Folder”, there is a checkbox that says “Redirect Folders”. If you check the box, you are then able to add folders below that you can share between your laptop and the VM. All you have to do then is press the plus sign, find the folder that you want to share, add it, and press save.

I just created a new folder on my desktop called Virtual Machine Sharing, then linked to it in the “Folders” tab above.

Finally, if you go into the file explorer in the Windows VM, you should be able to see the folder you shared with yourself in the sidebar and access it, like this:

Part 2: Install Solidworks and make your first GPU rendering

Skip this step if you are only interested in using Folding@Home.

Now you can install Solidworks on your virtual machine. When you’re in the VM, here’s the form you can fill out to request the download: https://www.solidworks.com/sw/education/SDL_form.html

Go to the Undergraduate CAD Moodle for the installation instructions, SEK ID, serial number, suggested settings, and all that jazz.

You may be prompted to restart the machine after Solidworks is downloaded/installed. I would recommend shutting down within the remote desktop, waiting a little while, then reconnecting. You could probably also press restart, wait for a while, then try to reconnect later. It may not want to connect if it is still restarting, I ran into some issues with that personally, just give it some time before trying to reconnect. If you encounter problems here, feel free to reach out to me via Messenger and I’ll see if there’s any more specific advice I can offer from my extensive experience of messing things up.

Once Solidworks is installed on the VM and everything, you can open up Solidworks Visualize. Import in some model you have already created (send it to yourself and download it to the VM) then make a quick animation of it, say a 10 second animation or something.

Now, click on the Output Tools icon.

Click on the Render icon and scroll down to Render Device. Select GPU.

Now go to the animation icon then set the file name, path, and everything to what you want them to be. Press Start Animation Render, then sit back and watch your amazing GPU work its magic.

For reference, the 10 second animation below took 7 hours to render on a uni machine. The GPU render on the virtual machine took 17 minutes.

This was using the “Fast” rendering option, just like the one I rendered on the uni machine. When I tested the “Accurate” rendering option, even that only took 30 minutes. I cannot imagine how long the “Accurate” option would have taken on the uni machine.

Part 3: Folding@Home

Here’s another cool thing you can do with your GPU VM when you are finished with your Solidworks renderings. Folding@Home is a really neat open source “distributed computing” project that uses resources from volunteers’ personal computers to simulate protein dynamics and find potential cures for diseases. If you ever wanted to be involved in citizen science, this is a neat opportunity.

So, let’s fold some proteins and donate some computing resources to scientists who are trying to identify potential therapies for COVID-19, as well as other diseases! Here is a post from FAH explaining how they are trying to use these simulations to fight COVID-19: https://foldingathome.org/2020/03/15/coronavirus-what-were-doing-and-how-you-can-help-in-simple-terms/

If you would like to help, use this link to install the software when you’re in your virtual machine: https://foldingathome.org/start-folding/

Follow the instructions, get it all set up, and you’ll eventually have a little dashboard that looks like this:

If you set “Power” to “Full”, it will use GPU folding and the CPU will be folding at full speed. “Medium” means that the CPU will be folding at 3/4 speed and the GPU folding will still be on. “Light” means that the CPU will fold at half speed and GPU will not be used. For more information: https://foldingathome.org/faqs/fah-v7/v7-introduction/web-control/folding-power-slider/

If you’re interested in learning more about the projects you’re contributing to, here’s a directory with all active projects at the moment:

You may have noticed that there’s an option to get points and join teams. If you want to look at team and donor statistics, take a look at this link:

I’ll make a team sometime and update this post with the team name and number if anyone wants to join. :)

If you have any questions, suggestions, or problems, reach out to me on Facebook Messenger and I’ll see if I can help.

I wish you all the best for the rest of the semester, please stay safe, and I’ll see ya’ll when uni is back in session. ❤

--

--

Sophia Davis
Sophia Davis

Written by Sophia Davis

Engineering Student, passionate about Makers Movement and Open Source Movement. :)

Responses (1)