HowToUseSharedStorage.rst 3.51 KB
Newer Older
1
2
3
4
5
6
7
8
9
**How to Use Shared Storage**
=============================

If you want to use your own storage during using NNI, shared storage can satisfy you.
Instead of using training service native storage, shared storage can bring you more convenience.
All the information generated by the experiment will be stored under ``/nni`` folder in your shared storage.
All the output produced by the trial will be located under ``/nni/{EXPERIMENT_ID}/trials/{TRIAL_ID}/nnioutput`` folder in your shared storage.
This saves you from finding for experiment-related information in various places.
Remember that your trial working directory is ``/nni/{EXPERIMENT_ID}/trials/{TRIAL_ID}``, so if you upload your data in this shared storage, you can open it like a local file in your trial code without downloading it.
kvartet's avatar
kvartet committed
10
And we will develop more practical features in the future based on shared storage. The config reference can be found `here <../reference/experiment_config.html#sharedstorageconfig>`_.
11
12
13

.. note::
    Shared storage is currently in the experimental stage. We suggest use AzureBlob under Ubuntu/CentOS/RHEL, and NFS under Ubuntu/CentOS/RHEL/Fedora/Debian for remote.
J-shang's avatar
J-shang committed
14
    And make sure your local machine can mount NFS or fuse AzureBlob and the machine used in training service has ``sudo`` permission without password. We only support shared storage under training service with reuse mode for now.
15
16
17
18
19
20
21
22
23

Example
-------
If you want to use AzureBlob, add below to your config. Full config file see :githublink:`mnist-sharedstorage/config_azureblob.yml <examples/trials/mnist-sharedstorage/config_azureblob.yml>`.

.. code-block:: yaml

    sharedStorage:
        storageType: AzureBlob
J-shang's avatar
J-shang committed
24
25
        # please set localMountPoint as absolute path and localMountPoint should outside the code directory
        # because nni will copy user code to localMountPoint
26
        localMountPoint: ${your/local/mount/point}
J-shang's avatar
J-shang committed
27
28
        # remoteMountPoint is the mount point on training service machine, it can be set as both absolute path and relative path
        # make sure you have `sudo` permission without password on training service machine
29
30
31
32
33
34
35
36
37
        remoteMountPoint: ${your/remote/mount/point}
        storageAccountName: ${replace_to_your_storageAccountName}
        storageAccountKey: ${replace_to_your_storageAccountKey}
        containerName: ${replace_to_your_containerName}
        # usermount means you have already mount this storage on localMountPoint
        # nnimount means nni will try to mount this storage on localMountPoint
        # nomount means storage will not mount in local machine, will support partial storages in the future 
        localMounted: nnimount

J-shang's avatar
J-shang committed
38
39
40
41
42
43
You can find ``storageAccountName``, ``storageAccountKey``, ``containerName`` on azure storage account portal.

.. image:: ../../img/azure_storage.png
   :target: ../../img/azure_storage.png
   :alt: 

44
45
46
47
48
49
50
51
52
53
54
55
56
57
If you want to use NFS, add below to your config. Full config file see :githublink:`mnist-sharedstorage/config_nfs.yml <examples/trials/mnist-sharedstorage/config_nfs.yml>`.

.. code-block:: yaml

    sharedStorage:
        storageType: NFS
        localMountPoint: ${your/local/mount/point}
        remoteMountPoint: ${your/remote/mount/point}
        nfsServer: ${nfs-server-ip}
        exportedDirectory: ${nfs/exported/directory}
        # usermount means you have already mount this storage on localMountPoint
        # nnimount means nni will try to mount this storage on localMountPoint
        # nomount means storage will not mount in local machine, will support partial storages in the future 
        localMounted: nnimount