Using “Raw MathLink Connections” to create a “Kernel Object”

Mathematica 8.0.0:

I am stuck trying to get a Mathematica Mathlink connection from my Windows computer working that should connects to Linux over network (or vice versa) and then launches a Kernel on the remote end (which I want to use to do some calculations on my Windows PC or vice versa).

For local connections it works on both operating system and I can use this Mathlink connection to launch a Kernel:

Needs[ "SubKernelsLinkKernels"]
kernel = FileNameJoin[{$InstallationDirectory, "MathKernel.exe"}]; link = LinkLaunch[kernel <> " -subkernel -mathlink"] LaunchKernels[link]  I have already tried to create MathLinks on one computer (let's say IP: 192.168.1.1) where the kernel is launched with: (*Computer which creates the remote link*) kernel = LinkLaunch[First[$CommandLine] <> " -mathlink"];
LinkWrite[kernel, Unevaluated[$ParentLink = LinkCreate["8000", LinkProtocol -> "TCPIP"];]]  But I cannot access this link when I use: (*Computer which wants to use the remote link*) link = LinkConnect["8000@192.168.1.1", LinkProtocol -> "TCPIP"] LinkRead[link] LinkRead[link] LinkWrite[link, Unevaluated[$ProcessID]]


Somehow I am also missing authentication informations for the computer which wants to connect in my code but I did not get an example which shows me where to state these credentials.

-
I see you were new, when you posted your question. Have you read the FAQ of our site? If an answer helps you, you should upvote it. If it solves your problem, you should accept it. And if you want to discuss details, use the comment-function here or go to chat. Doing nothing might be considered as rude and it's unlikely (at least the same) people help you again. –  halirutan Oct 28 '12 at 23:28

Unfortunately, I have only a Linux and a Mac combination here to try but maybe I can give some hints. First, you should setup your systems in your local network so you can use ssh without password.

Then you should carefully study Preferences->Parallel->Remove Kernels->Custom launch command. This things is likely to need some adjustment. On my Linux machine it looks like

It's obvios, that the "math" call will not work on my MacOSX machine where Mathematica is installed under /Applications and the terminal can not call it directly. Furthermore, the kernel is call MathKernel. After adjustment I used the following custom launch command

After this it worked instantly (I turned the local parallel kernels off):

LaunchKernels[]

(*
{KernelObject[1, "192.168.1.116"], KernelObject[2, "192.168.1.116"],
KernelObject[3, "192.168.1.116"],  KernelObject[4, "192.168.1.116"]}
*)

$SystemID ParallelEvaluate[$SystemID]

(*
"Linux-x86-64"
{"MacOSX-x86-64", "MacOSX-x86-64", "MacOSX-x86-64", "MacOSX-x86-64"}
*)

-