Skip to content

Instantly share code, notes, and snippets.

@hereismari
Last active December 3, 2023 17:14
Show Gist options
  • Save hereismari/cef4cb3440408e44963d1447a7db5ae0 to your computer and use it in GitHub Desktop.
Save hereismari/cef4cb3440408e44963d1447a7db5ae0 to your computer and use it in GitHub Desktop.
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow

Setting up a MSI laptop with GPU (gtx1060)

Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow

Installing Ubuntu 18.04

Get Image

https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0

Install (solving issues)

  • Security boot disable (change this in BIOS, for MSI computers reboot system and press delete a couple of times before the OS is loaded)
  • Possible problem: Screen freezing while installing
    • Reboot system
    • Go to the Install Ubuntu option (BUT DONT PRESS ENTER)
    • Press e
    • Find the line that starts with linux then add modprobe.blacklist=nouveau after quiet splash.
  • Choose a Wifi Network and install third party software and updates
  • Once the installation is done, remove the pendrive and reboot system

Installing Nvidia Drivers

  • Select Ubuntu at GRUB (you may need to repeat the modprobe.blacklist=nouveau step if the screen freezes again).
  • Make sure security boot is disable
  • Access command line (ctrl+alt+ F1,F2,F3...F??)
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
    # You can change this driver to whatever version suits you best :)
    sudo apt install nvidia-driver-396
    sudo reboot
    

Installing Conda

https://docs.anaconda.com/anaconda/install/linux

Installing CUDA 9.0 and CUDNN 7.0

https://medium.com/@taylordenouden/installing-tensorflow-gpu-on-ubuntu-18-04-89a142325138

Installing Pytorch 0.4

create conda env

conda create -n torch python=3.6

install torch (cuda 9)

conda install -y pytorch=0.4 torchvision cuda90 -c pytorch

if cuda 9 fails, install this way using cuda 8

conda install -y pytorch=0.4 torchvision -c pytorch conda install cuda80 -c soumith

test gpu install

python -c 'import torch; print(torch.rand(2,3).cuda())'

Installing TensorFlow (1.8)

https://www.tensorflow.org/install/install_linux#installing_with_anaconda

REMEMBER

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

test gpu install

python -c 'from tensorflow.python.client import device_lib; device_lib.list_local_devices()'

output:

2018-06-11 11:32:18.954198: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/device:GPU:0 with ...)

Getting my battery to last for longer

  1. Open the app "Nvidia X Server Settings"
  2. Go to "PRIME profiles" and select the Intel (Power Saving Mode).
  3. Then restart or log out your user session and log in again.

This way you'll be using the Intel integrated graphics card and the battery will last way more. To use the Nvidia GPU, just repeat the process above but choose Nvidia (Performance Mode).

In a MSI Gs65 Stealth, with nvidia 1060GTX it lasts about 8h with the Intel GPU enabled. It's a minor issue while not using the nvidia graphics cards.

@callibicknese
Copy link

Hey, thank you for this! I have been researching like crazy for two days trying to get Ubuntu installed on my MSI laptop. This guide helped

@akhil93R
Copy link

Thank a lot. Amazing !
Ubuntu work on my MSI GL62 7RD
bro am facing the issue while installing ubuntu 20.05 on my windows i have gtx1050 nvidia graphics card can u tell me how to install plzzz

@syntakker
Copy link

@D4r3-D3v1L
Copy link

I Installed Ububtu 20.04 on MSI GF63 9SC , in ubuntu the battery draining so fast compared to Windows.

How to make my battery good in Ubuntu ??

@syntakker
Copy link

@D4r3-D3v1L: Switching between graphic cards might help, if the graphic card is the reason.
To switch between Intel and NVidia graphics, do:

  1. Open the app "Nvidia X Server Settings"
  2. Go to "PRIME profiles" and select Intel (Power Saving Mode) or one of the NVidia options.
  3. Then restart or log out your user session and log in again.

@D4r3-D3v1L
Copy link

@syntakker I already did it , even though it's not fixed, full charge -2 hours in Ubuntu and 4+ hours in Windows

Is there any other way

Thank you

@syntakker
Copy link

@D4r3-D3v1L No real idea. I would look for processes with unusually high cpu consumption, and monitor overall cpu usage, maybe you'll find some hint there.
Otherwise check if it might be an ACPI issue. In my setup I've added an additional acpi_osi=! acpi_osi='Windows 2009' in the grub command line, see: https://gist.github.com/syntakker/1ce0328222dee3409fb96e2965953317
Maybe you can explore further there.

@venkeythemonkey
Copy link

Thanks! I very happy that found this tutorial. My Ubuntu works fine on MSI GL63 8RC. Thanks again

Hey, I'm also using MSI GL63 8RC. just curious about battery backup on ubuntu. how is it?

@D4r3-D3v1L
Copy link

@venkeythemonkey I'm using gf63 9sc and it is very bad , it only lasts for 2+hours instead of 4+

@kalindkaria
Copy link

kalindkaria commented Sep 1, 2021

About the battery drain, it's pretty easy. Open the app "Nvidia X Server Settings", go to "PRIME profiles" and select the Intel GPU. Then restart or log out your user session and log in again. This way you'll be using the Intel integrated graphics card and the battery will last way more.

In a MSI Gs65 Stealth, with nvidia 1060GTX it lasts about 8h with the Intel GPU enabled. It's a minor issue while not using the nvidia graphics cards. If you want to play video games, this graphics card is still suitable for many of them. But obviously it's best to switch back to the nvidia one for more exigent games.

Hi, I'm having MSI GF63 laptop (Take a look at this MSI GF63 Thin Core i5 9th Gen - (8 GB/512 GB SSD/Windows 10 Home/4 GB Graphics/NVIDIA GeForce GTX 1650 Max-Q) GF63 Thin 9SCXR-418IN Gaming Laptop on Flipkart
https://dl.flipkart.com/s/6Vv0psNNNN)

Tried fixing the boot issue with regards to Nvidia drivers in Ubuntu 20.04. Booting problem is sorted but when I switch to using Intel GPU, the sound is turned off, can't hear anything through speakers or through headphone jack.
Can anyone help me with this? If I switch to using Nvidia GPU, then everything is normal.

And much thanks to @hereismari for this tutorial. It really saved me from believing that something is wrong with the laptop I bought 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment