Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
Have you tried keeping your code in github/bitbucket repos and doing a git pull before a Get (on remote)? –  rm -rf Oct 28 '13 at 19:08
    
Dropbox is also an option: How do I put my packages into Dropbox –  rm -rf Oct 28 '13 at 22:22
    
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. –  Albert Retey Oct 29 '13 at 9:37
    
@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. –  Liam William Nov 16 '13 at 3:22
    
@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... –  Albert Retey Nov 17 '13 at 13:26

2 Answers 2

up vote 2 down vote accepted

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?

share|improve this answer
    
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? –  xslittlegrass Mar 23 at 19:10
    
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. –  halirutan Mar 23 at 20:05
    
OK, I see, thanks! –  xslittlegrass Mar 23 at 20:33

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"]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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