1

I'm assisting a professor in setting up a lab for a class in parallel programming. The process will be the following:

A student logs into a virtual machine running Windows 7. This machine has no GPUs available. It has version 7.5 of the CUDA toolkit installed along with Visual Studio 2013. Students are supposed to use Visual Studio to write their CUDA programs/projects.

To test/run these projects, students have remote access to a fairly high-end machine. I don't have physical access to it, but from what I can tell using the command line, it has four NVIDIA Tesla M40s. Students have remote access to this machine via SSH. The issue, though, is that this machine is running Linux (Ubuntu 14.04.5). I'm trying to figure out how to deploy what students write in Visual Studio on Windows to the Linux box with the GPUs. I have limited experience in C, C++, and CUDA. I can work my way around a make file, but specific instructions on this topic (if it's part of the solution) would be appreciated.

I have read this article—Creating CUDA Projects for Linux—which details how to get NVIDIA's sample projects running, but I'm not sure if I can adapt this to work in the given situation.

I'm looking for a simple way for students to write assignments in CUDA, but they also need to be able to run what they write. The reason that this professor and I prefer Visual Studio are:

  • It's something many students in this class are familiar with

  • It handles project architecture fairly well

  • It offers students a GUI which can help reduce the learning curve (students can focus on CUDA instead of terminal, gcc, etc.—these things are undeniably incredibly useful, but they're not the focus of the class)

If the test machine were running Windows, then students would be able to simply transfer the contents of the debug or release folder for their solutions in Visual Studio (on the development VM) to the test machine and then run the executable. Since there are two different operating systems in play, I don't imagine it will work like this. I know that writing code on Windows and deploying on Linux won't be quite as easy, but I'm hoping there's a feasible solution.

Reconfiguring the setup and having students develop directly on the test machine or creating a Linux VM for development is doable, but should be avoided if at all possible. Reconfiguration would require involving the systems admin team and would delay the process of getting students writing code.

I have researched this and I've come across these questions, but they don't quite apply to this specific case:

How to write programs in C# .NET, to run them on Linux/Wine/Mono?

How should I develop CUDA on OSX and the deploy test on Linux

  • 1
    The really short answer is that you can't do this – talonmies Sep 18 '16 at 20:04
  • That's what I was afraid of. What's the best alternative? –  Sep 18 '16 at 20:05
  • 1
    From your windows VM, use putty and ssh to log into the linux machine. write/compile/run your code there. If you desire a GUI IDE, have the students use tool like Mobaxterm from their windows VM to connect with an X-forwarded SSH session to the Linux box. Then run nsight eclipse edition in the linux box, with the GUI forwarded to the windows box. In that case, each student should have a separate account on the linux box. – Robert Crovella Sep 18 '16 at 20:08
  • @RobertCrovella and talonmies, thanks for the input. Robert, I looked at Mobaxterm and found a free alternative: TightVNC. I don't have admin permissions on the 4-GPU machine at the university, but I do have a Raspberry Pi at home. I set up a VNC server just to make sure something like this could work, and then installed the viewer on my Windows pc. Everything runs like a charm, and this seems easily transferable to the machine at school. I have decent experience with Eclipse, so I expect that should be fairly easy. If you post your comment as an answer, I'd likely accept. –  Sep 18 '16 at 21:41
  • 1
    @arbitrarystringofletters: better yet, please post your scripted solution and notes as an answer. We see Qs like this all the time on S.O. that never get resolved in any meaningful way. A real step-by-step description of what you have done will turn into a long term source of rep points.(Will be happy to vote for multiple reasonable answers to this problem). Good luck to all. – shellter Sep 18 '16 at 22:16
  • 1
    I agree, I'd rather learn something myself. If you post your answer describing what works well about TightVNC and how you used it, that would be interesting to me, and probably others. My answer probably wouldn't be much more than my (already posted) comment anyway. – Robert Crovella Sep 18 '16 at 23:39
  • 1
    I did almost a decade of mixed Windows/Linux development with CUDA, and for small projects such as those your students will create, the simplest solution I found was to use command-line tools and a plain makefile, using Cygwin on Windows to get gmake functionality. No Cmake, no Eclipse, no nothing.The few OS dependencies needed for the makefile can be abstracted and isolated in one file. Worked like a charm, integrated easily with automated scripted testing, etc. Can students of today function in such an "archaic", non-GUI environment? I don't know. – njuffa Sep 20 '16 at 08:07
  • @njuffa Haha, I can appreciate the "archaic" comment. I agree that command line tools are incredibly useful to learn, but I'm just an assistant with this class. Ultimately, the decision to use an IDE is the professor's, and I understand his reasoning. Students in this class are already familiar with Eclipse, and parallel programming is a difficult topic for most. Using Eclipse helps reduce the barrier of entry and shifts the focus toward the course content instead of learning the command line. –  Sep 20 '16 at 15:07
  • @RobertCrovella I may post my own solution if I get a chance, but I'm swamped right now. Thanks for the suggestion! –  Sep 20 '16 at 15:08
  • @arbitrarystringofletters Judging by the amount of "How can I do taskX with MSVS / CMAKE / Eclipse" questions I have seen on various forums, these "advanced" tools appear to be creating copious amounts of additional confusion, thus distracting from the programming task at hand. Add to that the panic that sets in with some when Intellisense puts a squiggly red line under a CUDA keyword it doesn't recognize ... – njuffa Sep 20 '16 at 15:17
  • @njuffa That's a very fair point. –  Sep 20 '16 at 15:18

1 Answers1

2

The direct answer to the question is that it is not really practical to try to take a VS solution/project and reconstruct it in linux. It may be possible, but I wouldn't put that burden on students trying to learn GPU programming.

An alternative would be to have your students use an X-forwarding SSH client such as Mobaxterm or else a remoting solution like TightVNC from the windows box (VM) to the linux box where the GPUs are. There are some nuanced differences between these two approaches. I believe the X-forwarded SSH client approach will have somewhat lighter network load and does not actually require an X-desktop to be running on the target, whereas TightVNC is an actual remote desktop solution. Therefore the user experience may be somewhat different for these two approaches, however if all the machines in question (windows VMs, linux GPU box(es)) have 100Mb or faster networking between them, and you're only running a few clients at a time, I think it may not matter much.

Either solution will probably work best if you establish individual user accounts on the linux box for each student/client.

And since the students will be sharing the GPU resources, if multiple students are trying to run projects simultaneously, there could be issues, but probably not a problem for introductory level programming work.

Once they have made a connection, the students can then launch nsight to run the linux-based GUI IDE (nsight Eclipse Edition) to build CUDA projects, and run/debug/profile them.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • Can you help me understand what X-forwarding is or can you point me to some resources on the topic? –  Sep 20 '16 at 15:05
  • 1
    X is the commonly used graphical display system on linux. X is a client-server based system. An X-forwarded SSH session allows the X-client and X-server to be on opposite ends of an SSH connection. Other than that, google is your friend, you can start [here](http://tldp.org/HOWTO/XDMCP-HOWTO/ssh.html) – Robert Crovella Sep 20 '16 at 16:42