oneapi-src / oneAPI-samples

Samples for Intel® oneAPI Toolkits
https://oneapi-src.github.io/oneAPI-samples/
MIT License
898 stars 675 forks source link

Error in the execution of PyTorch_Hello_World.py #513

Closed Andrea8Testa closed 3 years ago

Andrea8Testa commented 3 years ago

Following the tutorial to make this sample work, after the installation of the oneAPI AI Analytics Toolkit, I executed the commands:


. /opt/intel/oneapi/setvars.sh
conda activate pytorch
cd /opt/intel/oneapi/intelpython/latest/envs/pytorch (where I cloned the script, as administrator)
python PyTorch_Hello_World.py 

I get the error:

Segmentation fault (core dumped)

Instead, if I try to clone the environment:

conda create --name usr_pytorch --clone pytorch

the error is:

Source:      /opt/intel/oneapi/intelpython/latest/envs/pytorch
Destination: /home/franka/.conda/envs/usr_pytorch
The following packages cannot be cloned out of the root environment:
 - file:///opt/intel/oneapi/conda_channel/linux-64::conda-4.9.2-py37hea4d9f2_0
Packages: 74
Files: 204

Downloading and Extracting Packages
cpuonly-1.0          | ########################################################################################################################################################## | 100% 
dataclasses-0.8      | ########################################################################################################################################################## | 100% 
python_abi-3.7       | ########################################################################################################################################################## | 100% 

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
        return getattr(module, func_name)(args, parser)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/cli/main_create.py", line 41, in execute
        install(args, parser, 'create')
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/cli/install.py", line 222, in install
        clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/cli/install.py", line 74, in clone
        index_args=index_args)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/misc.py", line 290, in clone_env
        force_extract=False, index_args=index_args)
      File "/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/conda/misc.py", line 90, in explicit
        assert not any(spec_pcrec[1] is None for spec_pcrec in specs_pcrecs)
    AssertionError

`$ /opt/intel/oneapi/intelpython/latest/bin/conda create --name usr_pytorch --clone pytorch`

  environment variables:
                 CIO_TEST=<not set>
                CLASSPATH=/opt/intel/oneapi/mpi/2021.2.0//lib/mpi.jar:/opt/intel/oneapi/dal/2021
                          .2.0/lib/onedal.jar
        CMAKE_PREFIX_PATH=/opt/intel/oneapi/tbb/2021.2.0/env/..:/opt/intel/oneapi/dal/2021.2.0:/
                          home/franka/elia_ws/devel:/home/franka/catkin_ws/devel:/home/franka/ws
                          _moveit/devel:/opt/ros/melodic
                CONDA_EXE=/opt/intel/oneapi/intelpython/latest/bin/conda
         CONDA_PYTHON_EXE=/opt/intel/oneapi/intelpython/latest/bin/python
               CONDA_ROOT=/opt/intel/oneapi/intelpython/latest
              CONDA_SHLVL=0
                    CPATH=/opt/intel/oneapi/tbb/2021.2.0/env/../include:/opt/intel/oneapi/mpi/20
                          21.2.0//include:/opt/intel/oneapi/mkl/latest/include:/opt/intel/oneapi
                          /ipp/2021.2.0/include:/opt/intel/oneapi/dev-utilities/2021.2.0/include
                          :/opt/intel/oneapi/dal/2021.2.0/include:/opt/intel/oneapi/compiler/202
                          1.2.0/linux/include
           CURL_CA_BUNDLE=<not set>
         FI_PROVIDER_PATH=
          LD_LIBRARY_PATH=/opt/intel/oneapi/tbb/2021.2.0/env/../lib/intel64/gcc4.8:/opt/intel/on
                          eapi/mpi/2021.2.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.2.0//lib/r
                          elease:/opt/intel/oneapi/mpi/2021.2.0//lib:/opt/intel/oneapi/mkl/lates
                          t/lib/intel64:/opt/intel/oneapi/ipp/2021.2.0/lib/intel64:/opt/intel/on
                          eapi/dal/2021.2.0/lib/intel64:/opt/intel/oneapi/compiler/2021.2.0/linu
                          x/lib:/opt/intel/oneapi/compiler/2021.2.0/linux/lib/x64:/opt/intel/one
                          api/compiler/2021.2.0/linux/lib/emu:/opt/intel/oneapi/compiler/2021.2.
                          0/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.2.0/l
                          inux/compiler/lib:/home/franka/elia_ws/devel/lib:/home/franka/catkin_w
                          s/devel/lib:/home/franka/ws_moveit/devel/lib:/opt/ros/melodic/lib:/opt
                          /halcon/lib/x64-linux
             LIBRARY_PATH=/opt/intel/oneapi/tbb/2021.2.0/env/../lib/intel64/gcc4.8:/opt/intel/on
                          eapi/mpi/2021.2.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.2.0//lib/r
                          elease:/opt/intel/oneapi/mpi/2021.2.0//lib:/opt/intel/oneapi/mkl/lates
                          t/lib/intel64:/opt/intel/oneapi/ipp/2021.2.0/lib/intel64:/opt/intel/on
                          eapi/dal/2021.2.0/lib/intel64:/opt/intel/oneapi/compiler/2021.2.0/linu
                          x/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.2.0/linux/l
                          ib
                  MANPATH=/opt/intel/oneapi/mpi/2021.2.0/man::/opt/intel/oneapi/compiler/2021.2.
                          0/documentation/en/man/common:
                  NLSPATH=/opt/intel/oneapi/mkl/latest/lib/intel64/locale/%l_%t/%N
                     PATH=/opt/intel/oneapi/intelpython/latest/bin:/opt/intel/oneapi/intelpython
                          /latest/bin/libfabric:/opt/intel/oneapi/mpi/2021.2.0/libfabric/bin:/op
                          t/intel/oneapi/mpi/2021.2.0/bin:/opt/intel/oneapi/mkl/latest/bin/intel
                          64:/opt/intel/oneapi/dev-utilities/2021.2.0/bin:/opt/intel/oneapi/comp
                          iler/2021.2.0/linux/bin/intel64:/opt/intel/oneapi/compiler/2021.2.0/li
                          nux/bin:/opt/intel/oneapi/compiler/2021.2.0/linux/ioc/bin:/opt/ros/mel
                          odic/bin:/home/franka/anaconda3/condabin:/opt/halcon/bin/x64-linux:/ho
                          me/franka/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
                          :/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
          PKG_CONFIG_PATH=/opt/intel/oneapi/mkl/latest/tools/pkgconfig:/home/franka/elia_ws/deve
                          l/lib/pkgconfig:/home/franka/catkin_ws/devel/lib/pkgconfig:/home/frank
                          a/ws_moveit/devel/lib/pkgconfig:/opt/ros/melodic/lib/pkgconfig
               PYTHONPATH=/home/franka/catkin_ws/devel/lib/python2.7/dist-
                          packages:/home/franka/ws_moveit/devel/lib/python2.7/dist-
                          packages:/opt/ros/melodic/lib/python2.7/dist-packages
       REQUESTS_CA_BUNDLE=<not set>
         ROS_PACKAGE_PATH=/home/franka/elia_ws/src:/home/franka/catkin_ws/src:/home/franka/ws_mo
                          veit/src/franka_ros/franka_description:/home/franka/ws_moveit/src/fran
                          ka_ros/franka_gripper:/home/franka/ws_moveit/src/franka_ros/franka_msg
                          s:/home/franka/ws_moveit/src/franka_ros/franka_hw:/home/franka/ws_move
                          it/src/franka_ros/franka_control:/home/franka/ws_moveit/src/franka_ros
                          /franka_example_controllers:/home/franka/ws_moveit/src/franka_ros/fran
                          ka_ros:/home/franka/ws_moveit/src/franka_ros/franka_visualization:/hom
                          e/franka/ws_moveit/src/geometric_shapes:/home/franka/ws_moveit/src/han
                          deye_calibration:/home/franka/ws_moveit/src/moveit/moveit:/home/franka
                          /ws_moveit/src/moveit_calibration-master/moveit_calibration_plugins:/h
                          ome/franka/ws_moveit/src/moveit_msgs:/home/franka/ws_moveit/src/moveit
                          /moveit_planners/moveit_planners:/home/franka/ws_moveit/src/moveit/mov
                          eit_plugins/moveit_plugins:/home/franka/ws_moveit/src/moveit_resources
                          /moveit_resources:/home/franka/ws_moveit/src/moveit_resources/fanuc_de
                          scription:/home/franka/ws_moveit/src/moveit_resources/fanuc_moveit_con
                          fig:/home/franka/ws_moveit/src/moveit/moveit_commander:/home/franka/ws
                          _moveit/src/moveit_resources/panda_description:/home/franka/ws_moveit/
                          src/moveit_resources/panda_moveit_config:/home/franka/ws_moveit/src/mo
                          veit_resources/pr2_description:/home/franka/ws_moveit/src/moveit/movei
                          t_core:/home/franka/ws_moveit/src/moveit/moveit_planners/chomp/chomp_m
                          otion_planner:/home/franka/ws_moveit/src/moveit/moveit_planners/chomp/
                          chomp_optimizer_adapter:/home/franka/ws_moveit/src/moveit/moveit_ros/m
                          oveit_ros:/home/franka/ws_moveit/src/moveit/moveit_ros/occupancy_map_m
                          onitor:/home/franka/ws_moveit/src/moveit/moveit_ros/perception:/home/f
                          ranka/ws_moveit/src/moveit/moveit_ros/planning:/home/franka/ws_moveit/
                          src/moveit/moveit_plugins/moveit_fake_controller_manager:/home/franka/
                          ws_moveit/src/moveit/moveit_kinematics:/home/franka/ws_moveit/src/move
                          it/moveit_planners/ompl:/home/franka/ws_moveit/src/moveit/moveit_ros/m
                          ove_group:/home/franka/ws_moveit/src/moveit/moveit_ros/manipulation:/h
                          ome/franka/ws_moveit/src/moveit/moveit_ros/robot_interaction:/home/fra
                          nka/ws_moveit/src/moveit/moveit_ros/warehouse:/home/franka/ws_moveit/s
                          rc/moveit/moveit_ros/benchmarks:/home/franka/ws_moveit/src/moveit/move
                          it_ros/planning_interface:/home/franka/ws_moveit/src/moveit/moveit_pla
                          nners/chomp/chomp_interface:/home/franka/ws_moveit/src/moveit/moveit_r
                          os/visualization:/home/franka/ws_moveit/src/moveit/moveit_runtime:/hom
                          e/franka/ws_moveit/src/moveit/moveit_ros/moveit_servo:/home/franka/ws_
                          moveit/src/moveit/moveit_setup_assistant:/home/franka/ws_moveit/src/mo
                          veit/moveit_plugins/moveit_simple_controller_manager:/home/franka/ws_m
                          oveit/src/moveit/moveit_plugins/moveit_ros_control_interface:/home/fra
                          nka/ws_moveit/src/panda_moveit_config:/home/franka/ws_moveit/src/rviz_
                          visual_tools:/home/franka/ws_moveit/src/moveit_visual_tools:/home/fran
                          ka/ws_moveit/src/moveit_calibration-
                          master/moveit_calibration_gui:/opt/ros/melodic/share
        SETVARS_VARS_PATH=/opt/intel/oneapi/tensorflow/latest/env/vars.sh
            SSL_CERT_FILE=<not set>
     TERMINATOR_DBUS_PATH=/net/tenshu/Terminator2
               WINDOWPATH=2

     active environment : None
            shell level : 0
       user config file : /home/franka/.condarc
 populated config files : /opt/intel/oneapi/intelpython/latest/.condarc
                          /home/franka/.condarc
          conda version : 4.9.2
    conda-build version : not installed
         python version : 3.7.9.final.0
       virtual packages : __glibc=2.27=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/intel/oneapi/intelpython/latest  (read only)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          file:///opt/intel/oneapi/conda_channel/linux-64
                          file:///opt/intel/oneapi/conda_channel/noarch
                          https://conda.anaconda.org/intel/linux-64
                          https://conda.anaconda.org/intel/noarch
          package cache : /opt/intel/oneapi/intelpython/latest/pkgs
                          /home/franka/.conda/pkgs
       envs directories : /home/franka/.conda/envs
                          /opt/intel/oneapi/intelpython/latest/envs
               platform : linux-64
             user-agent : conda/4.9.2 requests/2.25.1 CPython/3.7.9 Linux/5.6.19-rt11 ubuntu/18.04.5 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

An unexpected error has occurred. Conda has prepared the above report.

How can be solved?

JoeOster commented 3 years ago

@ louie-tsai Can you look at this and work with the customer on it.

JoeOster commented 3 years ago

@jingxu10 - Can you take a look at this please

jingxu10 commented 3 years ago

Which version of AI Analytics Toolkit have you tried? How did you installed it? I just tried ai kit docker image (https://hub.docker.com/r/intel/oneapi-aikit), the hello world script worked correctly.

Andrea8Testa commented 3 years ago

I tried the Intel® oneAPI AI Analytics Toolkit (https://software.intel.com/content/www/us/en/develop/tools/oneapi/ai-analytics-toolkit.html#gs.2chtw8) for Linux operating system selecting the Web & Local distribution. I chose the online installer and I used the two commands shown in the Command Line Installation section. After the installation I followed this guide (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-ai-linux/top/before-you-begin.html#before-you-begin) for the set up. All the scripts are executed without errors, so I thought that the installation was executed correctly. The hello world script seems not to be included in this toolkit, so I had to clone it from this Github Repository. I tried to clone it inside and outside the environment "pytorch" but the result remained the same.

jingxu10 commented 3 years ago

I cannot reproduce the error you reported. The code ran successfully with the following steps on my machine.

  1. wget https://registrationcenter-download.intel.com/akdlm/irc_nas/17766/l_AIKit_p_2021.2.0.1101_offline.sh
  2. sudo bash l_AIKit_p_2021.2.0.1101_offline.sh
  3. source /opt/intel/oneapi/setvars.sh
  4. conda activate pytorch
  5. wget https://raw.githubusercontent.com/oneapi-src/oneAPI-samples/master/AI-and-Analytics/Getting-Started-Samples/IntelPyTorch_GettingStarted/PyTorch_Hello_World.py
  6. python PyTorch_Hello_World.py
Andrea8Testa commented 3 years ago

Ok thank you, I tried your steps and it actually works. Maybe I did something wrong when I followed the get started guide (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-ai-linux/top.html).

Anyway I am still not able to run this code on the GPU, that is the real reason why I downloaded this toolkit (since I have an Intel graphic card).

If I add to the code the lines:

    device = "cuda" if torch.cuda.is_available() else "cpu"
    print("Using {} device".format(device))

It still not able to find any GPU.

jingxu10 commented 3 years ago

Intel GPU support has not been enabled in public version of oneAPI package yet. The packages in current oneAPI AI Analytics Toolkit are all for CPU for now. We will release the packages later once they are ready to go.

Andrea8Testa commented 3 years ago

Ok, so it seems there are no options to use GPU with Intel graphic card. Anyway, thank you very much for the help.