How to Debug CUDA code on a remote server? - cuda

I want to debug the CUDA code on the remote server, My equipment is as follows:
Pc: Ubuntu 16.04,CUDA 8.0.61,nvcc v8.0.61,Geforce MX150 and integrated graphics
Server: Ubuntu 14.04,CUDA 8.0.61,nvcc v8.0.61,Tesla P100-PCIE*2
I have installed the Nsight Eclipse Edition 7.5 on my pc, What I want is to use the remote debug function that I can use the Visual debug window on my PC and remote gdbserver,But I have encountered some problems.
When I configure remote debugging to try to connect to a remote server,the Connection timed out return from the connection.
I don't know if it's related to the port. When I log in to the server, it looks like this:
SSH -P 50034 username#xxx.xxx.xxx.xxx
When setting up the connection, I noticed that port 2345 seems to be used, so I don't know if there is a conflict.The setting page is like this:
So far,I have tried the following:
Reinstall the Nsight Eclipse Edition,and debug sample code on the server in the command line which runs correctly.
Some forums mention that port 2345 should be opened,AFAIK,You can use this port as long as the port is not occupied when requested,but,I am not sure about it.
Considering that the server has certain restrictions on the visitor's IP address,so I tried to change the network several times but failed in the end.
Any ideas?

This problem was finally solved and I got a sigh of relief.
Since my server is in a cluster, ports are mapped. For example, the command when connecting to the server the port id should be attached with (i.e.ssh -p 50034 uesrname#xxx.xxx.xxx.xxx), so when the nsight eclipse edition's port 2345 (default) accesses the server, it does not recognize the port, then the time out delay is given, so I mapped the port 2345 to the server's port 2345, The map roughly as shown below:
-A PREROUTING -d xxx.xxx.xxx.xxx -p tcp -m tcp --dport 2345 -j DNAT --to-destination xxx.xxx.xxx.xxx:2345
The first xxx.xxx.xxx.xxx is the server's IP adress while the last one is the real adress of ur server in the cluster such as 11.11.11.24,which is Owing to the different conditions.

Related

Unable to connect to mysql running inside WSL2

I have the mysql server running inside WSL2, but I am unable to connect to it from MysqlWorkbench or Intellij Idea.
I tried the following command:
netsh interface portproxy add v4tov4 listenport=3306 listenaddress=0.0.0.0 connectport=3306 connectaddress=172.24.132.32
Which is supposed to forward a request to port 3306 to WSL2 IP. But still, it didn't work. Is there any way to solve this?
The following is the output of the netstat command:
It's easiest to use localhost, 127.0.0.1, or (if on IPv6) ::1 to access services running in WSL2 from Windows.
WSL includes a feature known as "localhost forwarding" which is enabled by default. This will (as it sounds) automatically forward traffic on the Windows localhost to the WSL2 instance, assuming that the port is listening in WSL2 (but not in Windows).
If this doesn't work, then you may have run into a WSL bug where localhostForwarding breaks when hibernating, or when Fast Startup is enabled in Windows (it is the default). If that's the case, try running the following in PowerShell:
wsl --shutdown
Then restart and try it again.
The IP address should work, but you don't mention how you are getting that IP. It changes every time WSL restarts, which is why it is generally preferred to use localhost. But if you want to try the IP, make sure that it is the one that you get from ip addr show eth0 inside WSL2.

How to access remotely a dockerised database container in Ubuntu OS?

Current Situation :
In my company we are using a windows server, in which we have installed Docker Quickstart Terminal. We have made a mysql-container and made a DB inside. We access the DB with python apps in remote pcs by using the server's IP in the code (host argument):
connx = mysql.connector.connect(user='root', password='somepass', host='192.XXX.XX.XX', port=3306, database='db_name', auth_plugin='mysql_native_password')
but we used port-forward in the server-side to access the dockerised DB, thus the packets are forwarded to 192.168.99.100 (default docker IP)
Future Situation:
The company has decided to change the server and use Ubuntu instead (v18.04 i think). Unfortunately i have very little experience with linux and could not find a simple answer as the following online :
'Which IP should we use on the host argument above ?'
Docker installation on linux does not seem to install a VM, so will the new server's IP be enough to access the dockerised IP remotely ?
PS : we will probably do a 'docker run -p 3306:3306 mysql:latest' command on the server to expose the ports
You should be able to access the database the say way you were able to access in Windows Server, i.e., using the IP of the Ubuntu host machine and port forwarding the containerized database port with the host port.

Can`t connect to mysql server on X.X.X.X on Windows

As the title says I want to connect remotely to mysql and it is on windows server but I got this error message.
Cant connect to mysql server on X.X.X.X
I am tring it with HeidiSql
I have MariaDB installed.
Also I can connect to server using remote connection.
Server is running and can connect to mysql localy
What have I tried:
I located my my.ini file and checked that I dont have one of these commands:
Skip-networking
bind-address = some IP
I didnt have them there in the first place
I logged in my MariaDB terminal and granted all permisions to user using this:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.100.%'
IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;
I have added port 3306 to windows firewall
I guess it is worth mentioning that I cant ping that server either
if I do
ping X.X.X.X
it returns:
Pinging X.X.X.X with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for X.X.X.X:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
I have spent many hours on forums and tried all instructions but still cant connect.
Any help would be much appreciated!
The detailed problem can be from two different causes:
First option:
MySQL is binded to 127.0.0.1 or no ip at all. Check netstat on windows cmd for locating 3306 port opened to mysql process and binded to your network LAN interface or 0.0.0.0 (not to loopback / 127.0.0.1 // ::1)
For check netstat, use netstat -a -n -o, you can see in the response the PID of the process too.
For check MySQL is working on the same machine, try to connect from local console using mysql -h 127.0.0.1 (for localhost connection) or mysql -h (your LAN IP) (If you have mysql binded only to your LAN IP address).
Second option:
If first test are OK. Maybe windows firewall is not configured correctly. Try to disable windows firewall (double check disabling it). The error response on your question are because windows firewall are active and blocking connections. When you have verified you can reach 3306 with firewall off, enable it and configure. Check always you're opening the port on the required network profile (Remember, windows firewall can have different rules for private / public connections).
For check firewall correctly configured, try to access to the 3306 port on the computer from another comp on the LAN.
If you have a huge LAN network with VLANs and similar technologies, check your routing topology. Also, remember always for initial checks, disable windows firewall. Your ping are failing because firewall are enabled.

Connect to mysql / oracle database with ssh

I want to connect to my database with the tool SquirreL in ssh.
Is it possible?
Sadly I have no other options for this server, so I ll have to change of tool if it is not working.
There's no way to do it directly through Squirrel, but it's ridiculously easy (when you know how) to set up the ssh tunnel that Squirrel can use.
I'd forgotten how, and came here looking for something to refresh my memory... but I had no luck on StackOverflow, so I did the research and I'm leaving the solution here for future-me... and hopefully it'll help someone else, too.
Create the ssh tunnel:
$ ssh -v -N -L3307:localhost:3306 remotehostname
I chose to use port 3307, since I also have MySQL running locally on port 3306.
Details (or you can just skip to step 2):
3307 is the port you want to use locally to refer to the remote system.
I believe that localhost here is referring to the remote system, from its own point of view, so localhost:3306 references the the standard MySQL port on the remote system.
-v is optional; it just makes ssh's output more verbose, which can help with troubleshooting. You're not going to be using the window running ssh for anything else, so might as well let it be chatty.
-N says you're not interested in actually opening a shell on the remote host. We're here for a database connection only.
If you have the verbose option turned on, you should see a message like this:
debug1: Local connections to LOCALHOST:3307 forwarded to remote address localhost:3306
If you don't have verbose output turned on, you'll only see something like Authenticated to 10.0.1.234 (via proxy).
Set up an "alias" in Squirrel that looks something like this:
Click Test and then Connect to test your connection.
If you ran ssh with the -v option, you can watch the window while you attempt to connect via Squirrel. You should see something like this for a successful connection:
debug1: Connection to port 3307 forwarding to localhost port 3306 requested.
debug1: channel 2: new [direct-tcpip]
debug1: channel 2: free: direct-tcpip: listening port 3307 for localhost port 3306, connect from 127.0.0.1 port 54536 to 127.0.0.1 port 3307, nchannels 3
When you're done with the database, just hit CtrlC in the ssh window to kill the tunnel (if you left off the -N option, I guess you'd have to hit CtrlD to close the shell).
Sadly squirrelSQL does not support ssh tunneling. Fortunately, MySQL Workbench does support ssh tunneling so I would recommend using that instead if you are connecting to a MySQL database.
An alternative to using a different tool is to use ssh port forwarding. Essentially you can forward port 3306 (or whatever port your MySQL DB uses) from the remote box to your local box. There are a number of guides on the web on how to do this. Once the tunnel with port forwarding is established you can use a local connection string like 'localhost:3306'. to connect to the remote db. It's good idea to put the ssh connection string in a .sh or .bat file because you'll have to run when you need to connect to the DB for the first time.

error 2003 : can't connect on '192.168.1.180' (10061)?

I am trying to log into server using -
mysql -u abc -p abc -h 192.168.1.180
But getting error -
error 2003 : can't connect on '192.168.1.180' (10061)
Please help me out how to connect.
I am using window 7 and trying to connect win xp.
i am able to ping win 7 but win 7 not able to ping me(just for information).
10061 is 'network connection refused'.
Check if mysql is actually listening with:
netstat -an | find '3306'
That line, run on the host which has mysql running on it, will tell you if mysql has an open network port. If mysql is actually externally accessible, it should return one line something like this(pardon me, I run linux so from memory..):
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING
Translation..
mysql is listening on all adapters: 0.0.0.0
listening on port 3306 :3306
3306 is the default port.
I believe my.cnf has to have bind-address un-commented to enable network connections though.
Edit: so if it is listening, try getting to it from the other box without involving mysql yet:
telnet <mysqlboxip> 3306
if that fails, you have a firewall issue.
Edit: Barring a firewall issue, next guess is you have mis-configured one of your network adapters. Make sure the netmask is the same on both machines, and (without explaining networking) you don't change anything but the last number when changing the address.. For your average home network, netmask should most likely be 255.255.255.0, and ip address should be in the 192.168.(1 or 15).(2-254)
If in doubt, turn dhcp back on, and look at what your router gives you for an address/netmask with:
ipconfig -a
Most home routers reserve upper addresses for dhcp assigned, so pick a low one. Stay outside the range used by the router for dhcp basically.
To see where the machine thinks it should sending the traffic:
tracert <mysqlboxip>
An incorrect netmask or a faulty route on either box could cause the traffic destined for the other box to go out the public internet way or off into nothingness.
There shoudn't be space between -p and abc as abc is password
mysql -u abc -pabc -h 192.168.1.180
Also Check bind-address in my.cnf it should be commented and also check your firewall settings.
First you confirm this address is being ping by doing this
ping 192.168.1.180