I have a c++ program that is multithreaded. I believe the throughput would increase if I could run it in the other computers connected by a switch. All of then are using the same OS(Ubuntu). Is there a way I can do it without changing the code? If I need to change the code what should I look for?
This is not generally possible without changing the code.
A multi-threaded program will make use of the processors on a single computer. As soon as you want to run the same program across a network of connected machines and have the various instances of the program communicate with each other, the code must do explicit message passing between the multiple copies of the program running on the different machines in the cluster.
There are libraries for doing this. A fairly well known standard is called Message Passing Interface, or MPI for short, and implementations of MPI exists for most free Unices.
If the processing that the program is doing is embarrassingly parallel, meaning multiple copies of the program would be able to process chunks of the input data without communicating with each other, then this may be an easier problem to solve and could possibly be done using GNU
In the end it comes down to what the program is actually doing.