Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2161 Discussions

SCP command fails after "source" setvars.sh in .bashrc

quantum
Beginner
4,691 Views

Hi everyone,

I am now using the oneAPI HPC Toolkit. I have installed it properly and there was no problem at all,  until I found that scp command for the server failed.

I put "source /opt/intel/oneapi/setvars.sh intel64" in the ~/.bashrc, so that intel compilers can be used once users login.

 

Unfortunately, "scp" doesn't work anymore when the setvars.sh is sourced in .bashrc, it gives no response after the password is entered, just like this:

 

user@local:~/Downloads$ scp test user1@123.12.123.123:/home/user1/warz
user1@123.12.123.123's password:
"A_BLANK_HERE"

 

When I comment the source statement, i.e. #source /opt/intel/oneapi/setvars.sh intel64, thing looks fine:


user@local:~/Downloads$ scp test user1@123.12.123.123:/home/user1/warz
user1@123.12.123.123's password:
test                                                                100%          6         5.7KB/s       00:00

Can anyone help me to solve this problem? Thank you a million.

0 Kudos
16 Replies
ShivaniK_Intel
Moderator
4,653 Views

 

Hi,

 

Thanks for reaching out to us.

 

Could you please provide us your system environment details(OS version)?

 

It is not recommended to use setvars.sh in .bashrc .However, regarding the issue, we will get back to you soon.

 

Thanks & Regards

Shivani

 

0 Kudos
quantum
Beginner
4,624 Views

Hi Shivani,

Thank you for your help.

I am using Centos 7:

===================================
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
===================================

and my env vars are:

===================================

User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi=vim
alias vp='vi ~/.bashrc'
alias cy='source ~/.bashrc'


# INTEL COMPILERS
source /opt/intel/oneapi/setvars.sh intel64
export LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/latest/linux/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/latest/lib/intel64/:$LD_LIBRARY_PATH
export FC=mpiifort
export F90=mpiifort
export F77=mpiifort
export CC=mpiicc
export CXX=mpiicpc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export WRF_DIR=/root/env_mod/WRFV43
export EM_CORE=1
export WRFIO_NCD_LARGE_FILE_SUPPORT=1


#======== ZLIB ========
export ZLIB=/root/local//zlib
export PATH=$ZLIB/bin:$PATH
export LD_LIBRARY_PATH=$ZLIB/lib:$LD_LIBRARY_PATH

#======== JPEG ========
export JPEG=/root/local//jpeg
export JPEG_LIBRARY=$JPEG/lib
export JPEG_INCLUDE_DIR=$JPEG/include
export PATH=$JPEG/bin:$PATH
export LD_LIBRARY_PATH=$JPEG/lib:$LD_LIBRARY_PATH

#======== JPEG-TURBO ========
#export JPEG_TB=/root/local//jpeg_turbo
#export PATH=$JPEG_TB/bin:$PATH
#export LD_LIBRARY_PATH=$JPEG_TB/lib:$LD_LIBRARY_PATH
#export JPEG_LIBRARY=$JPEG_TB/lib
#export JPEG_INCLUDE_DIR=$JPEG_TB/include

#======== CURL ========
#export CURL=/root/local/curl
#export PATH=$CURL/bin:$PATH
#export LD_LIBRARY_PATH=$CURL/lib:$LD_LIBRARY_PATH

#======== SZIP ========
export SZIP=/root/local/szip
export PATH=$SZIP/bin:$PATH
export LD_LIBRARY_PATH=$SZIP/lib:$LD_LIBRARY_PATH

#======== HDF4 ========
export HDF4=/root/local/hdf4
export PATH=$HDF4/bin:$PATH
export LD_LIBRARY_PATH=$HDF4/lib:$LD_LIBRARY_PATH

#======== HDF5 ========
export HDF5=/root/local/hdf5
export PATH=$HDF5/bin:$PATH
export LD_LIBRARY_PATH=$HDF5/lib:$LD_LIBRARY_PATH

#======== PNETCDF ========
export PNETCDF=/root/local/pnetcdf
export PATH=$PNETCDF/bin:$PATH
export LD_LIBRARY_PATH=$PNETCDF/lib:$LD_LIBRARY_PATH

#======== NETCDF ========
export NETCDF=/root/local/netcdf
export PATH=$NETCDF/bin:$PATH
export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH

#======== JASPER ========
export JASPER=/root/local/jasper
export PATH=$JASPER/bin:$PATH
export JASPERLIB=$JASPER/lib
export JASPERINC=$JASPER/include
export LD_LIBRARY_PATH=$JASPER/lib:$LD_LIBRARY_PATH

#======== PNG ========
export PNG=/root/local/
export PATH=$PNG/bin:$PATH
export LD_LIBRARY_PATH=$PNG/lib:$LD_LIBRARY_PATH

==================================================

 

Thanks a lot.

 

0 Kudos
ShivaniK_Intel
Moderator
4,593 Views

Hi,


Thanks for providing the requested details, we have tried doing SCP by keeping source setvars.sh in .bashrc file we are not able to reproduce the issue at our end and it is working fine for us. We will get back to you soon with more information

 

Thanks & Regards

Shivani

 

0 Kudos
PaulF_IntelCorp
Employee
4,569 Views

Hi @quantum :

 

Do you see the same problem if you initialize outside of your .bashrc file? In other words, comment out the "source /opt/intel/oneapi/setvars.sh intel64" line in your ~/.bashrc file and do the following at the command-line in a terminal session:

 

$ source /opt/intel/oneapi/setvars.sh intel64
$ scp test user2@123.12.123.123:/home/user1/warz
$ ...

 

Does your scp operation work when you setup the oneAPI dev environment manually at a terminal session, after your ~/.bashrc has completed?

The only thing I can think of that might be happening is that a local bash variable might be getting stomped on in a way that impacts your ssh/scp utilities.

 

Paul

0 Kudos
quantum
Beginner
4,473 Views

Hi Paul,

I am sorry for my late response.

Q: Do you see the same problem if you initialize outside of your .bashrc file?
A: No. Everything is fine if I do the initialization outside of my .bashrc

Q: Does your scp operation work when you setup the oneAPI dev environment manually at a terminal session, after your ~/.bashrc has completed?
A: SCP does its work perfectly when the oneAPI env is manually set after my .bashrc is completed. It seems to me that scp will go through my .bashrc first, and it strikes when it knows oneAPI is initialized there.

Thanks for your help!

 

quantum  

0 Kudos
PaulF_IntelCorp
Employee
4,442 Views

Hello quantum:

I think I may have misunderstood the parameters when I first looked at this. I'm guessing that the issue you are encountering is related the .bashrc file on your destination machine (the CentOS machine), not the .bashrc file on your local machine. If that is the case the issue is described here:

https://unix.stackexchange.com/a/154431/103967

In essence, scp is expecting the remote session to be a "non-interactive" session. If some unexpected output is generated by the remote machine during the scp session it will cause scp to fail. This is likely what is happening when you source setvars.sh on the remote machine in your .bashrc file. This problem with scp is described in more detail by following the link above, including some recommendations about how to deal with it.

Paul

0 Kudos
ShivaniK_Intel
Moderator
4,492 Views

Hi,


As you are facing an issue with source setvars.sh in bashrc file, could you please try using the Modulefiles?


Modulefiles are an alternative to using the setvars.sh script to initialize the one API environment.



For more details you can refer to "Getting Started with the modulefiles-setup.sh Script" from the below link:


https://software.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-modulefiles-with-linux.html


Thanks & Regards

Shivani



0 Kudos
quantum
Beginner
4,473 Views

Hi Shivani, 

Thank you for the suggestion, I will try that and get back very soon!

quantum

0 Kudos
ShivaniK_Intel
Moderator
4,355 Views

Hi,


As we didn't hear back from you, Is your issue resolved? If yes, please confirm whether we can close the thread or not.


Thanks & Regards

Shivani


0 Kudos
quantum
Beginner
4,331 Views

Hi Shivani,

 

I have installed the modulefiles-setup.sh successfully by following the given instruction, but I have a problem on loading the compilers.

# module load compiler
Loading compiler version 2021.3.0
compiler/latest(106):ERROR:102: Tcl command execution failed: if { [ info exists ::env(LMOD_VERSION_MAJOR) ] } {
if { ![ is-loaded debugger ] } { module try-add debugger }
if { ![ is-loaded dpl ] } { module try-add dpl }
if { ![ is-loaded oclfpga ] } { module try-add oclfpga }
} else {
if { ![ is-loaded debugger ] && [ is-avail debugger ] } { module load debugger }
if { ![ is-loaded dpl ] && [ is-avail dpl ] } { module load dpl }
if { ![ is-loaded oclfpga ] && [ is-avail oclfpga ] } { module load oclfpga }
}

# module load compiler/2021.3.0
Loading compiler version 2021.3.0
compiler/2021.3.0(106):ERROR:102: Tcl command execution failed: if { [ info exists ::env(LMOD_VERSION_MAJOR) ] } {
if { ![ is-loaded debugger ] } { module try-add debugger }
if { ![ is-loaded dpl ] } { module try-add dpl }
if { ![ is-loaded oclfpga ] } { module try-add oclfpga }
} else {
if { ![ is-loaded debugger ] && [ is-avail debugger ] } { module load debugger }
if { ![ is-loaded dpl ] && [ is-avail dpl ] } { module load dpl }
if { ![ is-loaded oclfpga ] && [ is-avail oclfpga ] } { module load oclfpga }
}

Then I comment the corresponding conditional statements in the compiler modulefile, the compilers work now.

==========================================================================================
Back to the original issue, i.e. the failure of scp. I replace the source statement of setvars.sh in .bashrc with the following module load statements:

module use /opt/intel/oneapi/modulefiles
module load compiler
module load mpi

 

Then, scp again:

local:~$ scp test.txt user1@123.12.123.123:/home/user1/
user1@123.12.123.123's password:
Loading compiler version 2021.3.0
Loading tbb version 2021.3.0
Loading compiler-rt version 2021.3.0
Loading mpi version 2021.3.0
test.txt                                          100%    146                59.9KB/s       00:00


SCP DOES ITS WORK NOW! I think the appearance of "module messages" is related to the reason mentioned by @PaulF_IntelCorp

Thank you very much for your help indeed. @ShivaniK_Intel  @PaulF_IntelCorp 


quantum

 

0 Kudos
PaulF_IntelCorp
Employee
4,319 Views

@quantum  -- glad to hear you got things working. 

 

What version of modulefiles are you using? Type `module --version` to see the version. I ask because I am trying to get that problem you ran into (the conditionals) fixed and I need that information.

 

--Paul

0 Kudos
quantum
Beginner
4,313 Views

Hi Paul,

 

I installed the env-modules by yum RPM in the Centos 7:
VERSION=3.2.10
DATE=2012-12-21

AUTOLOADPATH=undef
BASEPREFIX="/usr/share"
BEGINENV=99
CACHE_AVAIL=undef
DEF_COLLATE_BY_NUMBER=undef
DOT_EXT=""
EVAL_ALIAS=1
HAS_BOURNE_FUNCS=1
HAS_BOURNE_ALIAS=1
HAS_TCLXLIBS=undef
HAS_X11LIBS=1
LMSPLIT_SIZE=1000
MODULEPATH="/etc/modulefiles"
MODULES_INIT_DIR="/usr/share/Modules/init"
PREFIX="/usr/share/Modules"
TCL_VERSION="8.5"
TCL_PATCH_LEVEL="8.5.13"
TMP_DIR="/tmp"
USE_FREE=undef
VERSION_MAGIC=1
VERSIONPATH=undef
WANTS_VERSIONING=0
WITH_DEBUG_INFO=undef

tclsh info:
% puts $tcl_version
8.5


Thanks a lot.

quantum

0 Kudos
PaulF_IntelCorp
Employee
4,282 Views

Thanks @quantum

Precisely the info I need.

  --Paul

0 Kudos
ShivaniK_Intel
Moderator
4,221 Views

Hi,

 

As your issue has been resolved, please let us know whether we can close this thread?

 

Thanks & Regards

Shivani

 

0 Kudos
quantum
Beginner
4,191 Views

Hi Shivani,

 

Yes, you can. Thanks a lot!

quantum

0 Kudos
ShivaniK_Intel
Moderator
4,173 Views

Hi,


Thanks for the confirmation.


Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread is no longer be monitored by Intel.


Thanks & Regards

Shivani


0 Kudos
Reply