Home » 2020 » January

Monthly Archives: January 2020

Manage and administration for MacBookPro MacOS MacAdmin

I have my own page on configuring configuring the MacBook Pro.

Scenario 1: a historical post Rstudio in Mac

I downloaded and install Rstudio, when I tried to launch it, it could not find R executable. It seems that I need to have R installed first.

On the source machine,

##Help post deserves the credit
# store_packages.R
#
# stores a list of your currently installed packages

tmp = installed.packages()

installedpackages = as.vector(tmp[is.na(tmp[,"Priority"]), 1])
save(installedpackages, file="~/Desktop/installed_packages.rda")

# restore_packages.R

On the designation machine

## The most straightforward way

# installs each package from the stored list of packages
load("~/Desktop/installed_packages.rda")
for (count in 1:length(installedpackages)) install.packages(installedpackages[count])

## Or, here is more careful way

# installs each package from the stored list of packages
load("~/Desktop/installed_packages.rda")

## These codes are used for installing packages
# function for installing needed packages
installpkg <- function(x){
  if(x %in% rownames(installed.packages())==FALSE) {
    if(x %in% rownames(available.packages())==FALSE) {
      paste(x,"is not a valid package - please check again...")
    } else {
      install.packages(x)           
    }
    
  } else {
    paste(x,"package already installed...")
  }
}

# install necessary packages
required_packages  <- installedpackages
lapply(required_packages,installpkg)

Installing caret package

When I tried to install the “caret” package, it depends on “ModelMetrics”. To install this package causes quite a lot effort.

People had similar problem when they tried to install "ModelMetrics", omp.h is missing, 
To install this, I need (1) become admin account (2) use the command "brew install libomp"
But, it fails to install "libomp" due to the homebrew error
So, I followed "brew doctor" suggestion and made it work!!
sudo mkdir -p /usr/local/Cellar /usr/local/Frameworks /usr/local/opt /usr/local/sbin
sudo chown -R $(whoami) /usr/local/Cellar /usr/local/Frameworks /usr/local/opt /usr/local/sbin

Scenario 2: working with GPU and GPU management in Mac

I am gradually collecting the information about MacOS GPU related information.

On support from Apple explains some basics.
First help doc on the allocating GPU under MacOS

Scenario 3: installation as an admin in MacOS

1. Become admin: su li11-admin with correct password
2. sudo -H "whatever installation command"
3. Enter the same password as admin

Scenario 4: how to make a screen shot

  • Hold "command" + "shift" + 4
  • A selection window pops up for selection
  • Drag and release the choice, a screen shot is taken and saved on desktop

Scenario 5: how to connect network drive via the samba drive

  • Click Screen Shot 2015-02-06 at 10.19.38 AM"Go" --> choose "Connect to Server
  • Choose the Screen Shot 2015-02-06 at 10.20.45 AMconnect "server address" and hit connect
  • After authentication, it is Screen Shot 2015-02-06 at 10.24.21 AMgood to go

Scenario 6: Basic installation

	
  • Install homebrew
  • Install wget: brew install wget
  • Jupyter can be installed on MacbookPro following this link.
  • Scenario 7: I want to access network drive from the command line

    Find this post very helpful!. After I go through the VPN and connected to the network drvie, using the /Volumnes/whateverDrive/
    

    Scenario 8: Install jupyter on my MacBookPro

    Initially, I found this

            
  • Jupyter can be installed on MacbookPro following this link.
  • Instead of installing as a root, it is suggest to sudo chown -R $(whoami) somedirectories,
  • Then, chmod u+w on somedirectories.
  • But, why don’t I start with jupyter.org??

    This link  seems more legit!
    

    Scenario 9: Install JDK (for eclipse) on my MacBookPro

    A very bad documentation from oracle
    

    Deep Learning with Python

    A great and popular book on deep learning, and a good course using this book with.

    Case 1 Set up profile and GPU on Tiguar

    # standard setup for Python 3.5 
    # (switches to the environment that has also MXNet)
    
    export PATH=/ddn/gs1/home/klimczakl/miniconda2/bin:$PATH
    source activate mxnet3
    
    # on bioinfoX
    export CUDA_VISIBLE_DEVICES=''
    
    # on tiguar - your preferred GPU for multiple processes
    #export CUDA_VISIBLE_DEVICES='1'
    
    #Since Lez logs in as me, I can't use export CUDA_VISIBLE_DEVICES='1'
    
    # use this to evaluate GPU memory 
    nvidia-smi
    # use next available GPU for if your preferred GPU close to full
    export CUDA_VISIBLE_DEVICES='2'
    
    export CUDA_ROOT=/ddn/gs1/home/klimczakl/miniconda2/envs/mxnet3
    python
    
    # now in Python interpreter
    # alternatively include in your script
    from keras import backend as K
    import tensorflow as tf
    config = tf.ConfigProto()
    config.gpu_options.allow_growth=True
    sess = tf.Session(config=config)
    
    # this will give you base GPU memory allocation
    nvidia-smi
    
    

    Special setup for Python 2.7

    # special setup for Python 2.7 (use based environment)
    # only for legacy Keras 0.3.3, Theano 0.8.2
    # requires "backend": "theano" in .keras/keras.json
    
    export PATH=/ddn/gs1/home/klimczakl/miniconda2/bin:$PATH
    export CUDA_VISIBLE_DEVICES='1'
    export CUDA_ROOT=/ddn/gs1/home/klimczakl/miniconda2
    
    python -s
    
    # now in Python interpreter
    import theano