Creating Ncloud TensorFlow Server
    • PDF

    Creating Ncloud TensorFlow Server

    • PDF

    Article summary

    Available in Classic

    Before use

    Q. What is Ncloud TensorFlow Server?

    • Ncloud TensorFlow Server facilitates quick implementation of deep learning and machine learning by providing typical deep learning and machine learning packages, including TensorFlow, as well as the web-based Jupyter Notebook that can write code.
    • Ncloud TensorFlow Server uses TensorFlow, which is an open source machine learning software library developed by the Google Brain team.

    Q. What kinds of products are there?

    • There are two products, ubuntu-16 and centOS-7, depending on the OS. (OS versions may differ.)
    • The only difference lies in the OS, and the packages provided are the same. If you don't have a particular preference, then we recommend that you select the Ubuntu product, which is more commonly used.

    Q. What types of packages are available, and can I use only the provided packages?

    • The main packages include TensorFlow, Keras, and PyTorch.
    • Since the package management tool called Anaconda is used, you can use the Conda binary to make additional installations of other packages.
    • Please refer to the Manage package section of the Jupyter Notebook user guide for information about installing and managing packages.

    Q. Can I use Java or other languages besides Python?

    • Although TensorFlow provides APIs such as Java and Go, their stability isn't guaranteed. We recommend that you use Python.

    Q. How is Ncloud TensorFlow Server created?

    • Create a server with the specifications you want, and then add storage as needed.
    • Fees will be charged by month or hour, and you can use the service by creating a server and setting up a connection environment.
    • To use the web-based Jupyter Notebook, you need to request a public IP and add ports in Set ACG.
    • Connect to the console and follow the steps specified below to easily create a server.

    tensorflow-1-1-100_en.svg

    Q. What server types are available?

    • The Ncloud TensorFlow Server types provided by NAVER Cloud Platform are divided into Standard, High Memory, CPU Intensive, and GPU. The features of each server type are as follows.
    1. Standard: The standard server of the NAVER Cloud Platform service that can be used for various IT businesses. It provides well-balanced server specifications and boasts of high availability and stability.
    2. High Memory: A high-memory server of more than 64 GB that is suitable for operating applications that are easily affected by memory performance. Up to 10 High Memory servers can be created, and the server number limit can be adjusted by making a request to Support.
    3. CPU Intensive: The Intel Xeon processor is equipped with TensorFlow that is optimally built for AVX512 Vector operations. It is suitable for high-performance deep learning workload processing. This CPU type only supports the Ubuntu 16.04 OS at this time.
    4. GPU: The server is equipped with GPUs of P40 and V100, and is suitable for environments that process data quickly. Up to 5 servers can be created, and the server number limit can be adjusted by making a request to Support.

    Q. Ncloud TensorFlow Server has been created. Where do I write the code?

    • The TensorFlow code can be written in Jupyter Notebook. Add Port 18888 to ACG and connect to [public IP address:18888] on the web browser.
    • There are data processing, visualization, and TensorFlow example files in the "samples" folder, so please refer to them if you are new to data analysis.

    Q. How do I use TensorBoard?

    • Add Port 18889 to ACG and connect to [public IP address:18889] through the web browser (Please refer to Set access environment).
    • Since the TensorBoard directory is located under the default Jupyter path (/home/ncp/workspace), you can specify this directory as the log directory in the TensorFlow code for usage.

    Q. I can't connect to Jupyter Notebook.

    • To use Jupyter Notebook, you need to request a public IP address to assign to the server, and Port 18888 must be added to ACG. (please refer to Set access environment)
    • If you are unable to make access, even after checking the public IP address and ACG, then the reason may be that the Jupyter process has stopped. Execute the "jup restart" command in the terminal and restart the process. (Please refer to Manage Jupyter process)

    **Q. (GPU only) When executing the TensorFlow code, the "out of memory" message is displayed and execution fails. **

    • Method 1: When executing multiple code simultaneously, the OOM issue may occur if the code executed first does not release any GPU memory. Shut down the code executed first and try again.
    • Method 2: Following the instructions from the official TensorFlow document, add the code for limiting GPU memory as shown below.
    • Map TensorFlow so that the process can see nearly all the memory of every GPU by default (assume that it is included in CUDA_VISIBLE_DEVICES). This reduces memory fragmentation and allows for more efficient use of GPU memory resources, which are relatively more valuable, in devices. Use the tf.config.experimental.set_visible_devices method to adjust the GPUs that can be accessed from TensorFlow.
    gpus = tf.config.experimental.list_physical_devices('GPU')
    if gpus:
      # Limit so that TensorFlow can only use the first GPU
      try:
        tf.config.experimental.set_visible_devices(gpus[0], 'GPU')
      except RuntimeError as e:
        # Accessible devices must be set when starting the program
        print(e)
    
    • In some cases, it should be set so that the process is assigned to only a part of the available memory, or that memory can be used for the amount required by the process. TensorFlow offers two methods for this to be possible.

    The first method involves calling tf.config.experimental.set_memory_growth and allowing an increase in memory. This assigns the amount of GPU memory required for assignment in runtime. A small amount of memory is assigned at first, and the GPU memory area assigned to the TensorFlow process is expanded when the program is executed and requires more GPU memory. Memory is not released since this worsens memory fragmentation. Enter the following code before a tensor or operation to allow the memory increase of a specific GPU.

    gpus = tf.config.experimental.list_physical_devices('GPU')
    if gpus:
      try:
        tf.config.experimental.set_memory_growth(gpus[0], True)
      except RuntimeError as e:
        # Memory increase must be set when starting the program.
        print(e)
    

    About Ncloud TensorFlow Server

    Ncloud TensorFlow Server provides typical deep learning and machine learning packages, including TensorFlow which is one of the most popular among data analysts, as installation types.

    Most analysis jobs can be performed since data preprocessing, visualization, natural language processing, and machine learning and deep learning packages are provided. If necessary, you can easily install an additional package or upgrade an existing one by using the GUI or console command in Jupyter Notebook.

    The web-based Jupyter Notebook allows you to perform jobs in the same analysis environment regardless of location, instantly check analysis results, and easily share them with others.

    It also provides an administration script that enables you to easily manage Jupyter processes in a terminal environment.

    For beginner analysts just starting their analysis jobs, machine learning (e.g., regression, classification, and clustering using scikit-learn) and deep learning regression and classification examples using Keras and TensorFlow, as well as data search and visualization, are provided.

    Create a Ncloud TensorFlow Server

    Step 1. Connect to console

    Log into the Console and click Server > Server.

    tensorflow-1-1-101_en.png

    ① To create a server, click [Create server].

    Step 2. Select server image

    Select a Ncloud TensorFlow Server image to create a server.

    tensorflow-1-1-102_en.png{height="" width=""}
    ① Select Application > Tensorflow.

    • “tensorflow-ubuntu-16.04-64-server” or “tensorflow-centos-7.3-64.”,the two products are basically the same except for the OS. If you do not have a particular preference, we recommend that you select the ubuntu product that is more commonly used.

    ② Click [Next]

    ③ Check the popup window for the instructions (to request a public IP address and ACG to use Jupyter Notebook, and change Jupyter password).

    ④ Click [OK] to close the popup window.

    Step 3. Set server

    Select a storage type, server type, pricing plan, and zone, and enter a server name.

    tensorflow-1-1-103_en.png

    ① Select a zone.

    • The currently provided zones are ‘KR-1’ and ‘KR-2’.

    ② Select a storage type to use as boot storage.

    • Select SSD for services that require high-performance I/O and HDD for general services. Please note that you can use SSD as additional storage only if the boot storage is SSD.

    ③ Select the server type you want.

    • Some server specifications may not be supported depending on the boot disk type.
    • Select one server type of Standard, High Memory, or GPU depending on your purpose.

    ④ You can select either a monthly or hourly pricing plan.

    ⑤ Enter a server name.

    • The name is used to identify servers, so it must be unique.

    ⑥ Click [Next].

    Step 4. Set authentication key

    If you have an existing login key, select Use an existing login key. Otherwise, create a new login key according to the following procedure.

    tensorflow-1-1-104_en.png

    ① Select Create a new login key.

    ② Enter a login key name.

    ③ Click [Create & save login key] to save the login key file to your local PC.

    • Issue a new login key.
    • After saving it, please keep the login key in a safe place on your PC.
    • The login key is used to obtain an initial administrator password.

    ④ Click [Next].

    Step 5. Set firewall

    You can set a firewall by either using an existing ACG or creating a new one.

    First, this describes how to set a firewall using an existing ACG.

    tensorflow-1-1-105_en.png

    ① You must select an ACG. Select one of the existing ACGs including the default ncloud-default-acg.

    • You can select up to 5 ACGs of your own.
    • You must select an ACG to activate [Next] button so that you can proceed with the setting.

    ② If you want to create and configure a new ACG besides your existing one, select Create a New ACG.

    ③ Click [Next].

    The following process shows how to set a firewall by creating a new ACG.

    tensorflow-1-1-106_en.png

    ① Click [Create ACG].

    ② Enter an ACG name.

    ③ In ACG setting, enter a protocol, an access source, and an allowed port to create.

    • Protocol: Select from TCP, UDP, and ICMP.

    • Access source: Enter an IP address or ACG name.

    • Allowed port: Specify a single port or range.

    • For a terminal connection, the rule for SSH “TCP/22” must be set in ACG of a server to be connected. “TCP/18888” rule must be additionally set to use Jupyter Notebook, and “TCP/18889” rule to use TensorBoard.

    • To add the rules, list a protocol, an access source, and an allowed port, and click [Add].

    ④ If ports 22, 18888 and 18889 are all added, click [Create].

    Step 6. Confirm

    Confirm the settings.
    tensorflow-1-1-107_en.png

    ① Make sure that the server image, server, login key, and ACG are set properly.

    ② After the final confirmation, click [Create server].

    • This may take several minutes or longer to be completed.

    Check server list

    Check if the created server is in the list.

    tensorflow-1-1-108_en.png

    ① The server you have created will appear in the list.

    ② Wait until the server is created, the package is installed, and the server status becomes Running.

    Set access environment

    Request public IP address

    To use Jupyter Notebook, you must use a public IP address to access the server, and you will be charged additionally for using a public IP address.

    tensorflow-1-1-201_en.png

    ① Select Public IP from the left menu.

    ② Click [Create Public IP] to get a public IP assigned.

    ③ From Select Server, select a Ncloud tensorflow Server to assign the public IP address.

    ④ Click [Next] button.

    ⑤ Confirm the server name and click [Create] button again.

    Set port forwarding

    To connect to a server via a terminal program (such as Putty), you must set port forwarding.

    tensorflow-1-1-202_en.png

    ① Select Server from the left menu.

    ② To connect to the server, click [Set Port Forwarding].

    ③ Set an external port number in the Set port forwarding window. The range of external port numbers is between 1024 and 65,534. It cannot be used for service purposes other than the feature to connect to a server.
    (The internal port number is set to 22.)

    ④ Click [Add] to add the setting to the bottom and select [Edit] or [Delete] to edit or delete the setting.

    ⑤ Click [Apply] for SSH connection to the configured external port using a terminal program.

    Set ACG

    Add SSH “TCP/22” rule for terminal connections and “TCP/18888” rule for Jupyter Notebook, and if necessary, “TCP/188889” rule for TensorBoar to ACG.

    If you have already added the rules when creating a server, you do not need to set ACG in this step.
    tensorflow-1-1-203_en.png

    ① Select ACG from the left menu.

    ② Select the ACG that you chose when creating a server and click [Set ACG] at the top.

    ③ In ACG rule setting, enter a protocol, an access source, and an allowed port to create.

    • Protocol: Select from TCP, UDP, and ICMP.

    • Access source: Enter an IP address or ACG name.

    • Allowed port: Specify a single port or range.

    • For a terminal connection, the rule for SSH “TCP/22” must be set in ACG of a server to be connected. “TCP/18888” rule must be additionally set to use Jupyter Notebook, and “TCP/18889” rule to use TensorBoard.

    • To add the rules, list a protocol, an access source, and an allowed port and click [Add].

    ④ When you're finished setting, click [Apply].

    ⑤ You can see the detailed information on Details tab and the rules you have set up on View Rules tab.

    Get admin password

    To connect to a server via terminal program (such as PuTTY), you need to know the administrator password.
    tensorflow-1-1-204_en.png

    ① Select Server from the left menu.

    ② Select a server, and from Manage Servers, click Get Admin Password.

    ③ Click [Drop files here or click to upload] to attach the login key file (.pem) saved on your PC when creating the server.

    ④ After attaching it, click [Get Admin Password] to get a password to use when first logging in to the server via terminal program.

    • It is recommended to change the password to one that the administrator can remember after connecting to the server.

    How to run Jupyter Notebook using a terminal

    You need to connect to your server via a terminal program (such as Putty) and change the Jupyter password.

    You can easily change your password and manage the Jupyter process through the provided administration script.

    Connect to the server via a terminal

    tensorflow-1-1-301_en.png

    ① Run a terminal program (such as Putty).

    ② Enter the values of "Public IP" and "External Port" confirmed in your server list or from the details of the server, and click [Open] to connect to the server.

    • Get a public IP: ‘Public IP’ of Port Forwarding Information in [Show] after selecting a server from Console > Server > Server list
    • Get an external port number: ‘External Port’ of Port Forwarding Information in [Show] after selecting a server from Console > Server > Server list

    ③ Enter the user information and password and log in.

    • login as: root
    • password: The administrator password identified above.

    ④ Please change the root account's password to one you can easily remember after first logging in.
    Enter the “passwd root” command to enter a new password.

    Change Jupyter password

    The initial password used for Jupyter Notebook is set to the server name. Please change the password through the script provided to prevent unauthorized access.

    tensorflow-1-1-302_en.png

    ① In the terminal, enter “jup passwd” to change your password.

    • Get an initial password: Same as the ‘server name’ identified from Console > Server > Server list

    • A password must contain at least one letter, one number, one special character, and be at least 8 characters.

    • If you execute the script to change a password, Jupyter processes will be automatically restarted.

    Manage Jupyter process

    If you have changed configuration files and are required to restart Jupyter process, you can stop or restart the process via the provided script.

    tensorflow-1-1-303_en.png

    ① Stop Jupyter process: $ jup stop

    ② Start Jupyter process: $ jup start

    ③ Stop and start Jupyter process: $ jup restart

    Manage TensorBoard process

    If you start Jupyter process for the first time after creating a server or are required to restart Jupyter process, you can stop or restart the process via the provided script.

    tensorflow-1-1-304_en.png

    ① Stop TensorBoard process: $ jup tb-stop

    ② Start TensorBoard process: $ jup tb-start


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.