How to install nvidia gt940m drivers for Arch linux

I have this nvidia geforce gt940m gpu in my hp pavillion laptop.Apart from official arch documentation (its jargon for me), how do i install its drivers for arch linux to use for cuda and deeplearning.

I need some more data. Please post the screen shot of lspci -v output for your nvidia gpu.

[SIZE=3]

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
Subsystem: Hewlett-Packard Company Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers
Flags: bus master, fast devsel, latency 0
Capabilities:
Kernel driver in use: skl_uncore

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07) (prog-if 00 [VGA controller])
Subsystem: Hewlett-Packard Company Skylake GT2 [HD Graphics 520]
Flags: bus master, fast devsel, latency 0, IRQ 132
Memory at 92000000 (64-bit, non-prefetchable) [size=16M][/SIZE]
[SIZE=3] Memory at a0000000 (64-bit, prefetchable) [size=256M][/SIZE]
[SIZE=3] I/O ports at 5000
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: i915
Kernel modules: i915

00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)
Subsystem: Hewlett-Packard Company Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at 94320000 (64-bit, non-prefetchable) [size=32K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: proc_thermal
Kernel modules: processor_thermal_device

00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21) (prog-if 30 [XHCI])
Subsystem: Hewlett-Packard Company Sunrise Point-LP USB 3.0 xHCI Controller
Flags: bus master, medium devsel, latency 0, IRQ 127
Memory at 94300000 (64-bit, non-prefetchable) [size=64K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci

00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP Thermal subsystem
Flags: bus master, fast devsel, latency 0, IRQ 18
Memory at 94332000 (64-bit, non-prefetchable) [size=4K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: intel_pch_thermal
Kernel modules: intel_pch_thermal

00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP CSME HECI
Flags: bus master, fast devsel, latency 0, IRQ 129
Memory at 94333000 (64-bit, non-prefetchable) [size=4K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: mei_me
Kernel modules: mei_me

00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21) (prog-if 01 [AHCI 1.0])
Subsystem: Hewlett-Packard Company Sunrise Point-LP SATA Controller [AHCI mode]
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 128
Memory at 94330000 (32-bit, non-prefetchable) [size=8K][/SIZE]
[SIZE=3] Memory at 94336000 (32-bit, non-prefetchable)
I/O ports at 5080
I/O ports at 5088
I/O ports at 5060
Memory at 94334000 (32-bit, non-prefetchable) [size=2K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: ahci
Kernel modules: ahci

00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 122
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: 00004000-00004fff [size=4K][/SIZE]
[SIZE=3] Memory behind bridge: 93000000-93ffffff [size=16M][/SIZE]
[SIZE=3] Prefetchable memory behind bridge: 0000000080000000-0000000091ffffff [size=288M][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: pcieport
Kernel modules: shpchp

00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 123
Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
I/O behind bridge: 00006000-00006fff [size=4K][/SIZE]
[SIZE=3] Memory behind bridge: 94200000-942fffff [size=1M][/SIZE]
[SIZE=3] Prefetchable memory behind bridge: 000000007c900000-000000007cafffff [size=2M][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: pcieport
Kernel modules: shpchp

00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 124
Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
I/O behind bridge: None
Memory behind bridge: 94100000-941fffff [size=1M][/SIZE]
[SIZE=3] Prefetchable memory behind bridge: None
Capabilities:
Kernel driver in use: pcieport
Kernel modules: shpchp

00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 125
Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
I/O behind bridge: 00003000-00003fff [size=4K][/SIZE]
[SIZE=3] Memory behind bridge: 94000000-940fffff [size=1M][/SIZE]
[SIZE=3] Prefetchable memory behind bridge: None
Capabilities:
Kernel driver in use: pcieport
Kernel modules: shpchp

00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP LPC Controller
Flags: bus master, medium devsel, latency 0

00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP PMC
Flags: bus master, fast devsel, latency 0
Memory at 9432c000 (32-bit, non-prefetchable) [size=16K][/SIZE]
[SIZE=3] Kernel driver in use: intel_pmc_core

00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP HD Audio
Flags: bus master, fast devsel, latency 32, IRQ 134
Memory at 94328000 (64-bit, non-prefetchable) [size=16K][/SIZE]
[SIZE=3] Memory at 94310000 (64-bit, non-prefetchable) [size=64K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel, snd_soc_skl

00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
Subsystem: Hewlett-Packard Company Sunrise Point-LP SMBus
Flags: medium devsel, IRQ 16
Memory at 94335000 (64-bit, non-prefetchable)
I/O ports at 5040
Kernel driver in use: i801_smbus
Kernel modules: i2c_i801

01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev a2)
Flags: bus master, fast devsel, latency 0, IRQ 133
Memory at 93000000 (32-bit, non-prefetchable) [size=16M][/SIZE]
[SIZE=3] Memory at 80000000 (64-bit, prefetchable) [size=256M][/SIZE]
[SIZE=3] Memory at 90000000 (64-bit, prefetchable) [size=32M][/SIZE]
[SIZE=3] I/O ports at 4000
Expansion ROM at [disabled]
Capabilities:
Kernel driver in use: nouveau
Kernel modules: nouveau

02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
Subsystem: Hewlett-Packard Company RTS522A PCI Express Card Reader
Physical Slot: 4
Flags: bus master, fast devsel, latency 0, IRQ 126
Memory at 94200000 (32-bit, non-prefetchable) [size=4K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: rtsx_pci
Kernel modules: rtsx_pci

03:00.0 Network controller: Intel Corporation Wireless 3165 (rev 81)
Subsystem: Intel Corporation Dual Band Wireless AC 3165
Flags: bus master, fast devsel, latency 0, IRQ 131
Memory at 94100000 (64-bit, non-prefetchable) [size=8K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi

04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 0a)
Subsystem: Hewlett-Packard Company RTL810xE PCI Express Fast Ethernet controller
Flags: bus master, fast devsel, latency 0, IRQ 130
I/O ports at 3000
Memory at 94004000 (64-bit, non-prefetchable) [size=4K][/SIZE]
[SIZE=3] Memory at 94000000 (64-bit, non-prefetchable) [size=16K][/SIZE]
[SIZE=3] Capabilities:
Kernel driver in use: r8169[/SIZE]
[SIZE=7][SIZE=7][SIZE=7][SIZE=4][SIZE=7][SIZE=7][SIZE=7][SIZE=3] Kernel modules: r8169[/SIZE][/SIZE][/SIZE][/SIZE][/SIZE][/SIZE][/SIZE][/SIZE]

Put this in /etc/X11/xorg.conf

hastebin

Install nvidia nvidia-settings bumblebee

systemctl enable --now bumblebee

Now try

optirun glxgears

systemctl enable --now bumblebee
Failed to enable unit: Unit file bumblebee.service does not exist.

seems a typo, its bumblebeed

I faced this ,
exec glxgears not found ,

sudo pacman -S mesa-demos

,fixed it