zoukankan      html  css  js  c++  java
  • 解放内存之搭建自己的 R Server

    学校的课五门有四门需要跑R程序,有一些长长长的代码实在是占用了太多的内存,果断决定搭个R的服务器放着自己跑。

    愉快的是,R studio server 的搭建真心简单快捷~这个从前被我忽略的东东终于排上用场啦!

    超级简单实用咩哈哈~

    首先开一个新的虚拟机

    搭建过程要点:

    • 本篇基于Ubuntu Server 16.04, Deployment Model 请选 classic
    • 关于size: 如果要在R里面跑大程序的画,选内存大的肯定是有用哒!看需求吧~

    对于以下代码,放个A0机子和DS1的对比:

    g <- rnorm(1000000)
    h <- rep(NA, 1000000)
    
    # Start the clock!
    ptm <- proc.time()
    
    # Loop through the vector, adding one
    for (i in 1:1000000){
      h[i] <- g[i] + 1
    }
    
    # Stop the clock
    proc.time() - ptm
    
    

    Basic A0 (0.25 Cores, 0.75 GB memory)

    > proc.time() - ptm
       user  system elapsed 
      6.104   0.180   6.294 
    

    Standard DS1_v2 (1 Core, 3.5 GB memory)

    > proc.time() - ptm
       user  system elapsed 
      1.148   0.004   1.359 
    
    • 设置--终结点, 配置Rstudio的TCP 端口. (默认8787)
    Rstudio (TCP/8787 到 8787)
    

    具体过程就不一步步的截图啦,请移步另一篇博客参考一下啦

    国际版Azure搭建L2TP VPN

    安装R-core

    有一次我居然非常蠢萌地忘记了安装R!!!!!= =

    $ sudo apt-get install r-base
    

    配置 Rstudio Server

    Rstudio Server 官网

    Download the RStudio Server Professional Admin Guide

    $ sudo apt-get update
    $ sudo apt-get install gdebi-core
    $ wget https://download2.rstudio.org/rstudio-server-0.99.903-amd64.deb
    $ sudo gdebi rstudio-server-0.99.903-amd64.deb
    
    $ sudo rstudio-server restart 
    

    服务器地址:

    http://<server-ip>:8787
    
    

    大功告成!


    友情Tips:

    • 用户名密码即Linux系统里面的既有用户。如果要新增用户在Linux里面adduser就可以啦。

    • 不同用户之间的r package是不共享的。如果需要设置共享R Library,需要额外设置。

  • 相关阅读:
    [Quote] Android Graphics Architecture
    New NFC log
    [Quote] 3.6 Namespaces
    NFC DAL(Driver Abstraction Layer) and OSAL(Operating System Abstraction Layer)
    Finance&Invest&Economics URL Links
    Concepts
    Tracking NFC Flow
    NFC log
    [IoE] About AllJoyn™
    [Quote] How does getSystemService() work exactly?
  • 原文地址:https://www.cnblogs.com/loca/p/6009865.html
Copyright © 2011-2022 走看看