How to install CUDA on 18.10 for an Optimus laptop?











up vote
0
down vote

favorite












I have a Thinkpad W520 with NVIDIA Quadro 1000M + integrated Intel GPU. I have just made a fresh install of Ubuntu 18.10 on it.



I want to achieve the following:




  • working CUDA,

  • working external display through DisplayPort/VGA,

  • in Optimus mode, if possible (selected that in the BIOS).


Status before installing anything



I had nouveau set up by default. It finds the external monitor through both DisplayPort and VGA (the connectors on the laptop), but it does not work consistently: the external monitor gets switched off after some time.



What I've done



I tried to install CUDA along with the corresponding NVIDIA driver:



sudo apt install nvidia-cuda-toolkit
sudo ubuntu-drivers autoinstall


Had a mysterious crash in the middle of compiling the kernel modules, then finished the install after a reboot with dkpg --configure -a. In the end, it installed CUDA 9.1.



At this point, the laptop:




  • boots in Optimus mode,

  • it does not detect external VGA monitor (will need to test HDMI),


  • glxinfo says that direct rendering is Yes,

  • the graphics is however not smooth (I see triangle-like artifacts appearing on screen when I move a window, or part of the screen is refreshed),

  • after unpacking and compiling some samples from the original 9.1 toolkit installer to verify CUDA, it turned out that CUDA also has problems.


matrixMul does not work, see output:



Error! Matrix[204798]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Error! Matrix[204799]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Result = FAIL


Strange enough, deviceQuery does work, see output:



./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "Quadro 1000M"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081751040 bytes)
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
( 2) Multiprocessors, ( 64) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 1400 MHz (1.40 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS


On an older Ubuntu version booting in NVIDIA-only mode selected in BIOS solved most of these problems (even though the battery drained very fast because of the lack of Optimus). However, this time Ubuntu does not boot at all in this mode.










share|improve this question
























  • I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
    – ubfan1
    Nov 1 at 15:41















up vote
0
down vote

favorite












I have a Thinkpad W520 with NVIDIA Quadro 1000M + integrated Intel GPU. I have just made a fresh install of Ubuntu 18.10 on it.



I want to achieve the following:




  • working CUDA,

  • working external display through DisplayPort/VGA,

  • in Optimus mode, if possible (selected that in the BIOS).


Status before installing anything



I had nouveau set up by default. It finds the external monitor through both DisplayPort and VGA (the connectors on the laptop), but it does not work consistently: the external monitor gets switched off after some time.



What I've done



I tried to install CUDA along with the corresponding NVIDIA driver:



sudo apt install nvidia-cuda-toolkit
sudo ubuntu-drivers autoinstall


Had a mysterious crash in the middle of compiling the kernel modules, then finished the install after a reboot with dkpg --configure -a. In the end, it installed CUDA 9.1.



At this point, the laptop:




  • boots in Optimus mode,

  • it does not detect external VGA monitor (will need to test HDMI),


  • glxinfo says that direct rendering is Yes,

  • the graphics is however not smooth (I see triangle-like artifacts appearing on screen when I move a window, or part of the screen is refreshed),

  • after unpacking and compiling some samples from the original 9.1 toolkit installer to verify CUDA, it turned out that CUDA also has problems.


matrixMul does not work, see output:



Error! Matrix[204798]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Error! Matrix[204799]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Result = FAIL


Strange enough, deviceQuery does work, see output:



./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "Quadro 1000M"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081751040 bytes)
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
( 2) Multiprocessors, ( 64) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 1400 MHz (1.40 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS


On an older Ubuntu version booting in NVIDIA-only mode selected in BIOS solved most of these problems (even though the battery drained very fast because of the lack of Optimus). However, this time Ubuntu does not boot at all in this mode.










share|improve this question
























  • I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
    – ubfan1
    Nov 1 at 15:41













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a Thinkpad W520 with NVIDIA Quadro 1000M + integrated Intel GPU. I have just made a fresh install of Ubuntu 18.10 on it.



I want to achieve the following:




  • working CUDA,

  • working external display through DisplayPort/VGA,

  • in Optimus mode, if possible (selected that in the BIOS).


Status before installing anything



I had nouveau set up by default. It finds the external monitor through both DisplayPort and VGA (the connectors on the laptop), but it does not work consistently: the external monitor gets switched off after some time.



What I've done



I tried to install CUDA along with the corresponding NVIDIA driver:



sudo apt install nvidia-cuda-toolkit
sudo ubuntu-drivers autoinstall


Had a mysterious crash in the middle of compiling the kernel modules, then finished the install after a reboot with dkpg --configure -a. In the end, it installed CUDA 9.1.



At this point, the laptop:




  • boots in Optimus mode,

  • it does not detect external VGA monitor (will need to test HDMI),


  • glxinfo says that direct rendering is Yes,

  • the graphics is however not smooth (I see triangle-like artifacts appearing on screen when I move a window, or part of the screen is refreshed),

  • after unpacking and compiling some samples from the original 9.1 toolkit installer to verify CUDA, it turned out that CUDA also has problems.


matrixMul does not work, see output:



Error! Matrix[204798]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Error! Matrix[204799]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Result = FAIL


Strange enough, deviceQuery does work, see output:



./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "Quadro 1000M"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081751040 bytes)
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
( 2) Multiprocessors, ( 64) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 1400 MHz (1.40 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS


On an older Ubuntu version booting in NVIDIA-only mode selected in BIOS solved most of these problems (even though the battery drained very fast because of the lack of Optimus). However, this time Ubuntu does not boot at all in this mode.










share|improve this question















I have a Thinkpad W520 with NVIDIA Quadro 1000M + integrated Intel GPU. I have just made a fresh install of Ubuntu 18.10 on it.



I want to achieve the following:




  • working CUDA,

  • working external display through DisplayPort/VGA,

  • in Optimus mode, if possible (selected that in the BIOS).


Status before installing anything



I had nouveau set up by default. It finds the external monitor through both DisplayPort and VGA (the connectors on the laptop), but it does not work consistently: the external monitor gets switched off after some time.



What I've done



I tried to install CUDA along with the corresponding NVIDIA driver:



sudo apt install nvidia-cuda-toolkit
sudo ubuntu-drivers autoinstall


Had a mysterious crash in the middle of compiling the kernel modules, then finished the install after a reboot with dkpg --configure -a. In the end, it installed CUDA 9.1.



At this point, the laptop:




  • boots in Optimus mode,

  • it does not detect external VGA monitor (will need to test HDMI),


  • glxinfo says that direct rendering is Yes,

  • the graphics is however not smooth (I see triangle-like artifacts appearing on screen when I move a window, or part of the screen is refreshed),

  • after unpacking and compiling some samples from the original 9.1 toolkit installer to verify CUDA, it turned out that CUDA also has problems.


matrixMul does not work, see output:



Error! Matrix[204798]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Error! Matrix[204799]=0.00000000, ref=3.19999981 error term is > 1.000000E-06
Result = FAIL


Strange enough, deviceQuery does work, see output:



./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "Quadro 1000M"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081751040 bytes)
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
( 2) Multiprocessors, ( 64) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 1400 MHz (1.40 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS


On an older Ubuntu version booting in NVIDIA-only mode selected in BIOS solved most of these problems (even though the battery drained very fast because of the lack of Optimus). However, this time Ubuntu does not boot at all in this mode.







multiple-monitors nvidia-optimus cuda 18.10






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 1 at 13:36

























asked Nov 1 at 11:55









ha7ilm

1012




1012












  • I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
    – ubfan1
    Nov 1 at 15:41


















  • I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
    – ubfan1
    Nov 1 at 15:41
















I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
– ubfan1
Nov 1 at 15:41




I have same model, and the 2.1 capability is too low for CUDA 9.1, try 8.0
– ubfan1
Nov 1 at 15:41










1 Answer
1






active

oldest

votes

















up vote
0
down vote













From what I've seen nvidia do not support ubuntu 18.10 as their driver does not work with the new abi 24. You are probably not running with the nvidia driver.



try adding the following two repositories to your sources.list



deb http://us.archive.ubuntu.com/ubuntu/ bionic main
deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /


and downgrade xserver-xorg-core and xserver-xorg-video-* and install cuda (which should install cuda-10)



see if that helps.



Cuda is generally backward compatible, so while the 1000m was relatively capable at the time, it's very old by now (8 years if memory serves) and I'm not sure how many things are still supported on it, but it should still run. As for battery, unless you replaced it recently, it's probably beyond end of life, so I wouldn't look at the battery as an indicator.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1089183%2fhow-to-install-cuda-on-18-10-for-an-optimus-laptop%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    From what I've seen nvidia do not support ubuntu 18.10 as their driver does not work with the new abi 24. You are probably not running with the nvidia driver.



    try adding the following two repositories to your sources.list



    deb http://us.archive.ubuntu.com/ubuntu/ bionic main
    deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /


    and downgrade xserver-xorg-core and xserver-xorg-video-* and install cuda (which should install cuda-10)



    see if that helps.



    Cuda is generally backward compatible, so while the 1000m was relatively capable at the time, it's very old by now (8 years if memory serves) and I'm not sure how many things are still supported on it, but it should still run. As for battery, unless you replaced it recently, it's probably beyond end of life, so I wouldn't look at the battery as an indicator.






    share|improve this answer

























      up vote
      0
      down vote













      From what I've seen nvidia do not support ubuntu 18.10 as their driver does not work with the new abi 24. You are probably not running with the nvidia driver.



      try adding the following two repositories to your sources.list



      deb http://us.archive.ubuntu.com/ubuntu/ bionic main
      deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /


      and downgrade xserver-xorg-core and xserver-xorg-video-* and install cuda (which should install cuda-10)



      see if that helps.



      Cuda is generally backward compatible, so while the 1000m was relatively capable at the time, it's very old by now (8 years if memory serves) and I'm not sure how many things are still supported on it, but it should still run. As for battery, unless you replaced it recently, it's probably beyond end of life, so I wouldn't look at the battery as an indicator.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        From what I've seen nvidia do not support ubuntu 18.10 as their driver does not work with the new abi 24. You are probably not running with the nvidia driver.



        try adding the following two repositories to your sources.list



        deb http://us.archive.ubuntu.com/ubuntu/ bionic main
        deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /


        and downgrade xserver-xorg-core and xserver-xorg-video-* and install cuda (which should install cuda-10)



        see if that helps.



        Cuda is generally backward compatible, so while the 1000m was relatively capable at the time, it's very old by now (8 years if memory serves) and I'm not sure how many things are still supported on it, but it should still run. As for battery, unless you replaced it recently, it's probably beyond end of life, so I wouldn't look at the battery as an indicator.






        share|improve this answer












        From what I've seen nvidia do not support ubuntu 18.10 as their driver does not work with the new abi 24. You are probably not running with the nvidia driver.



        try adding the following two repositories to your sources.list



        deb http://us.archive.ubuntu.com/ubuntu/ bionic main
        deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /


        and downgrade xserver-xorg-core and xserver-xorg-video-* and install cuda (which should install cuda-10)



        see if that helps.



        Cuda is generally backward compatible, so while the 1000m was relatively capable at the time, it's very old by now (8 years if memory serves) and I'm not sure how many things are still supported on it, but it should still run. As for battery, unless you replaced it recently, it's probably beyond end of life, so I wouldn't look at the battery as an indicator.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 1 at 6:53









        user567021

        11




        11






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1089183%2fhow-to-install-cuda-on-18-10-for-an-optimus-laptop%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei