4
$\begingroup$

I usually works remotely using kernels on our hpc and front-end on my local laptop. This enable me do relatively large computation within my laptop(IP address of my laptop may change frequently). But there is a problem when come across packages. Since I manage all the packages on my local computer, I can't just use Get["mypack.m"] when I use remote kernel, instead, I have to copy all the packages to my remote machine before Get. However, I'm constantly developing the packages and copying them back and forth between local and remote computer is quiet tedious. Are there simpler ways to deal with it?

$\endgroup$
8
  • 1
    $\begingroup$ Have you tried keeping your code in github/bitbucket repos and doing a git pull before a Get (on remote)? $\endgroup$
    – rm -rf
    Commented Oct 28, 2013 at 19:08
  • $\begingroup$ Dropbox is also an option: How do I put my packages into Dropbox $\endgroup$
    – rm -rf
    Commented Oct 28, 2013 at 22:22
  • $\begingroup$ if you are constantly changing your packages I fully support rm -rf suggestion to use a version control system. Using a distributed one like git or mercurial will make it especially easy to set up everything so you only need a pull + update on the remote machines before loading the packages. You don't necessarily need to resign your code to a repository hoster (or dropbox) for that if you don't want to. $\endgroup$ Commented Oct 29, 2013 at 9:37
  • $\begingroup$ @AlbertRetey It probably wouldn't be the best to simply call git init in the $UserBase packages directory, but I could be wrong. I'm not certain but I'm willing to be his concern isn't the dropbox/git but correctly setting up package loading on both systems so it works. $\endgroup$
    – William
    Commented Nov 16, 2013 at 3:22
  • $\begingroup$ @LiamWilliam: I agree that it isn't the best solution to use the complete $UserBaseDirectory as a repository, although I think it wouldn't do any harm. I also agree that the OP didn't mention to have concerns about using a repository hoster. I just wanted to make clear that rm-rf's suggestion not necessarily means that this is necessary (in case the OP or any reader would have concerns). Describing such a setup in detail is some work (and to a large extent is covered by the tools documentation) and depends on the OPs specific demands, that's probably why neither me nor anyone else did it... $\endgroup$ Commented Nov 17, 2013 at 13:26

2 Answers 2

2
$\begingroup$

I have not tested this at all, but the default behavior when you Import a package is "Get". If you access your remote machine over the network, isn't an easy method to start an ftp-server on your local machine an load the packages with Import?

For instance it is possible to load packages directly from github (although there, you don't need to login):

Import["https://raw.githubusercontent.com/halirutan/SymbolInformationPalette/master/SymbolInformationPalette.m"]

The same should be possible with ftp, Import and an authentication with username and password. Have you considered this option?

$\endgroup$
3
  • $\begingroup$ Thanks, yes I've considered that, but I think that maybe a little bit complicate for me. I never have any experience using a online repository. How do you think the idea in my answer? $\endgroup$ Commented Mar 23, 2014 at 19:10
  • $\begingroup$ My suggestion was not an online repository! I just gave an example that you can load a package with Import and you are free to use various protocols like http, ftp, sftp. I suggested to load the packages directly from your local machine but with e.g. the ftp protocol. You start your remote kernel from the local machine and the remote machine opens an ftp connection back to your local machine to load the packages. $\endgroup$
    – halirutan
    Commented Mar 23, 2014 at 20:05
  • $\begingroup$ OK, I see, thanks! $\endgroup$ Commented Mar 23, 2014 at 20:33
0
$\begingroup$

I think the suggestion by rm -rf and halirutan are really great for long term development, but I guess using the online repository is kind of like over shooting the problem for me. My code are relatively small and simple and it would be tedious to push every time I made some small changes.

For my problem, I found out that I can just use the local front end to execute the package on my local computer, then somehow the package will be loaded to the remote kernel:

UsingFrontEnd@NotebookEvaluate["mypack.m"]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.