{"action":"created","issue":{"url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/15","labels_url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/15/comments","events_url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/15/events","html_url":"https://github.com/mbraceproject/MBrace.StarterKit/issues/15","id":71257804,"number":15,"title":"How to handle long-live remote instance?","user":{"login":"soloman817","id":3477345,"avatar_url":"https://avatars.githubusercontent.com/u/3477345?v=3","gravatar_id":"","url":"https://api.github.com/users/soloman817","html_url":"https://github.com/soloman817","followers_url":"https://api.github.com/users/soloman817/followers","following_url":"https://api.github.com/users/soloman817/following{/other_user}","gists_url":"https://api.github.com/users/soloman817/gists{/gist_id}","starred_url":"https://api.github.com/users/soloman817/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soloman817/subscriptions","organizations_url":"https://api.github.com/users/soloman817/orgs","repos_url":"https://api.github.com/users/soloman817/repos","events_url":"https://api.github.com/users/soloman817/events{/privacy}","received_events_url":"https://api.github.com/users/soloman817/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-27T11:34:04Z","updated_at":"2015-04-27T11:54:11Z","closed_at":null,"body":"Hi guys,\r\n\r\nI tested mbrace today, and it is very nice. But I have one question which I cannot figure out from the examples. I know this is not an issue, but I would like to ask for some suggestions.\r\n\r\nSay, we have a GPU library, which provides a type GPUModule, so usually we can create a type like:\r\n\r\n```fsharp\r\ntype MyModule(gpu) =\r\n    inherit GPUModule(gpu)\r\n    ....\r\n```\r\n\r\nIf you new an instance of this module type, you will get GPU code compiled and loaded in the specified GPU device which installed on your remote machine. Now I can create cloud monad like:\r\n\r\n```fsharp\r\nlet job = \r\n    cloud {\r\n        use mymodule = new MyModule(GPU.[0])\r\n        return mymodule.Foo(blabla) }\r\n    |> cluster.CreateProcess\r\n```\r\n\r\nThe problem here is, the constructing of MyModule type is time-cost, it will compile GPU code and load it into GPU device, so it is not very good to create it each time you run the cloud computation. Is there a way to create a long-live remote instance for each worker? then in the cloud we can reference them?\r\n\r\nOne way I think might be using the custom serivce, and extend the worker to provide a way to store the compiled and loaded module, but again, in the custom service sample, I don't see how to extend the worker feature.\r\n\r\nSo, if any suggestion and hint, I appreciate that.\r\n\r\nRegards,\r\nXiang.\r\n"},"comment":{"url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/comments/96619986","html_url":"https://github.com/mbraceproject/MBrace.StarterKit/issues/15#issuecomment-96619986","issue_url":"https://api.github.com/repos/mbraceproject/MBrace.StarterKit/issues/15","id":96619986,"user":{"login":"soloman817","id":3477345,"avatar_url":"https://avatars.githubusercontent.com/u/3477345?v=3","gravatar_id":"","url":"https://api.github.com/users/soloman817","html_url":"https://github.com/soloman817","followers_url":"https://api.github.com/users/soloman817/followers","following_url":"https://api.github.com/users/soloman817/following{/other_user}","gists_url":"https://api.github.com/users/soloman817/gists{/gist_id}","starred_url":"https://api.github.com/users/soloman817/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soloman817/subscriptions","organizations_url":"https://api.github.com/users/soloman817/orgs","repos_url":"https://api.github.com/users/soloman817/repos","events_url":"https://api.github.com/users/soloman817/events{/privacy}","received_events_url":"https://api.github.com/users/soloman817/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T11:54:11Z","updated_at":"2015-04-27T11:54:11Z","body":"Thanks very much, I think this is easier way than extend the worker like in custom service demo. I will try it tomorrow and then close this issue."}}