cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

arkanet
Adept I

ADL2_Overdrive6_Temperature_Get and X server

Hi all!

I run C/OpenCL codes for some calculations on a remote Linux machine. I want to monitor GPU temperature, so if it gets too high, the code execution stops. But sadly, ADL function ADL2_Overdrive6_Temperature_Get needs X server to be running, and since I'm connected via SSH, I can not startX.

Is there anything to do to go around this? Why reading a sensor needs X server anyway?

Thanks in advance.

0 Likes
1 Solution

Sorry for the delay, I've been off sick for a few days.  Nasty cold.

Anyhow.  Good news for you all.

There is an API, but it is not presently documented in the public SDK. I have asked the ADL team to make that API public in the next release.  In the meantime, I will provide the API syntax here.  Note that this is available in ADL and ADL 2 releases in the  last couple of years or so, but might not be in older ADL drops (I have not run a history check).

Now, this documentation cut is pretty raw, since it has not been published yet it is not vetted, so caveat emptor applies here.  But we're all veterans, so I'm sure you will do just fine.


ADL:
/// \brief Set the file descriptor which can communicate with the console driver
///
/// This function sets ADL to console mode. In this mode, ADL will not use XServer to communicate with the driver, but use IOCTL instead.
/// An optional file descriptor may be passed in ADL to use instead of letting it determine a
/// file descriptor automatically. This file descriptor must point to an open AMD GPU device.
/// The file descriptor can be generated by using the ukiOpen function provided by the ATIUKI shared library.
/// This is an AMD provided library, and the Linux Base driver team can offer more information on how to use ukiOpen.
/// If the file descriptor is not set, ADL will determine the file descriptor automatically.
/// This must be called before \ref ADL_Main_Control_Create. If this function is called afterwards,
/// the function will fail.
/// \platform
/// \LNX
/// \param[in] fileDescriptor an open file descriptor to an AMD GPU device. If ADL_UNSET is used, then
/// ADL will use it's own file descriptor.
/// \return ADL_OK if ADLis set to the new mode and uses the new file descriptor, else an ADL error code \ref define_adl_result
int ADL_ConsoleMode_FileDescriptor_Set(int fileDescriptor);

ADL2:
/// \brief Set the file descriptor which can communicate with the console driver
///
/// This function sets ADL to console mode. In this mode, ADL will not use XServer to communicate with the driver, but use IOCTL instead.
/// An optional file descriptor may be passed in ADL to use instead of letting it determine a
/// file descriptor automatically. This file descriptor must point to an open AMD GPU device.
/// The file descriptor can be generated by using the ukiOpen function provided by the ATIUKI shared library.
/// This is an AMD provided library, and the Linux Base driver team can offer more information on how to use ukiOpen.
/// If the file descriptor is not set, ADL will determine the file descriptor automatically.
/// This must be called before \ref ADL2_Main_Control_Create. If this function is called afterwards,
/// the function will fail.
/// \platform
/// \LNX
/// \param[in] context: Client's ADL context handle \ref ADL_CONTEXT_HANDLE obtained from \ref ADL2_Main_Control_Create.
/// \param[in] fileDescriptor an open file descriptor to an AMD GPU device. If ADL_UNSET is used, then
/// ADL will use it's own file descriptor.
/// \return ADL_OK if ADLis set to the new mode and uses the new file descriptor, else an ADL error code \ref define_adl_result
/// \remarks Clients can use ADL2 version of the API to assure that there is no interference with other ADL clients that are running in the same process . Such clients have to call \ref ///ADL2_Main_Control_Create first to obtain \ref ADL_CONTEXT_HANDLE instance that has to be passed to each subsequent ADL2 call and finally destroyed using \ref ADL2_Main_Control_Destroy.
int ADL2_ConsoleMode_FileDescriptor_Set(ADL_CONTEXT_HANDLE context, int fileDescriptor);

View solution in original post

5 Replies
arkanet
Adept I

I found another function ADL_PM_Temperature_Get(), any chance that it does not need a X server running? I could not find any documentation about how to use it.

0 Likes

Hello.

There is a way to access some of the ADL functions without using X.  When you initialise ADL (I don't have the APIs in front of me, I'm offsite, so I'm going by memory), you can request to initialise/connect via "Console Mode" instead of "X" mode.  This allows you to make calls without going via X, however, some of the ADL functions must be handled by the X Server, though some are handled by the AMD kernel mode driver - the latter functions are accessible via console mode.  I'll try to find someone more familiar with this (may take a day or two, as they are in a different geography), but in the meantime, have a look at the API set and the accompanying developer guide, I seem to remember there being a sample code there to use the console version of initialisation.

I should also mention that X via SSH is very possible, most SSH implementations allow X forwarding.  I mention this because another way to initialise ADL is to supply your existing X handle.  Might not be suitable in this scenario, but good to know in case you find it useful.

Good luck!

Thanks a lot,

I could not find the API which can initialize ADL in console mode, despite my vast searches. I'd be grateful if you could help me on this.

BTW, I have a Radeon HD 4670 on my system which is connected to monitor, and a Radeon HD 7950 for OpenCL calculations. I can not install drivers for both of them (I do not know why, but installing fglrx for 4670 removes fglrx for 7950, and I need 7950 for OpenCL) so I have to go to run level 3 for 4670. Therefore there are problems to forward X over SSH 😞

Thanks again for you help. Wish you the best.

0 Likes

Sorry for the delay, I've been off sick for a few days.  Nasty cold.

Anyhow.  Good news for you all.

There is an API, but it is not presently documented in the public SDK. I have asked the ADL team to make that API public in the next release.  In the meantime, I will provide the API syntax here.  Note that this is available in ADL and ADL 2 releases in the  last couple of years or so, but might not be in older ADL drops (I have not run a history check).

Now, this documentation cut is pretty raw, since it has not been published yet it is not vetted, so caveat emptor applies here.  But we're all veterans, so I'm sure you will do just fine.


ADL:
/// \brief Set the file descriptor which can communicate with the console driver
///
/// This function sets ADL to console mode. In this mode, ADL will not use XServer to communicate with the driver, but use IOCTL instead.
/// An optional file descriptor may be passed in ADL to use instead of letting it determine a
/// file descriptor automatically. This file descriptor must point to an open AMD GPU device.
/// The file descriptor can be generated by using the ukiOpen function provided by the ATIUKI shared library.
/// This is an AMD provided library, and the Linux Base driver team can offer more information on how to use ukiOpen.
/// If the file descriptor is not set, ADL will determine the file descriptor automatically.
/// This must be called before \ref ADL_Main_Control_Create. If this function is called afterwards,
/// the function will fail.
/// \platform
/// \LNX
/// \param[in] fileDescriptor an open file descriptor to an AMD GPU device. If ADL_UNSET is used, then
/// ADL will use it's own file descriptor.
/// \return ADL_OK if ADLis set to the new mode and uses the new file descriptor, else an ADL error code \ref define_adl_result
int ADL_ConsoleMode_FileDescriptor_Set(int fileDescriptor);

ADL2:
/// \brief Set the file descriptor which can communicate with the console driver
///
/// This function sets ADL to console mode. In this mode, ADL will not use XServer to communicate with the driver, but use IOCTL instead.
/// An optional file descriptor may be passed in ADL to use instead of letting it determine a
/// file descriptor automatically. This file descriptor must point to an open AMD GPU device.
/// The file descriptor can be generated by using the ukiOpen function provided by the ATIUKI shared library.
/// This is an AMD provided library, and the Linux Base driver team can offer more information on how to use ukiOpen.
/// If the file descriptor is not set, ADL will determine the file descriptor automatically.
/// This must be called before \ref ADL2_Main_Control_Create. If this function is called afterwards,
/// the function will fail.
/// \platform
/// \LNX
/// \param[in] context: Client's ADL context handle \ref ADL_CONTEXT_HANDLE obtained from \ref ADL2_Main_Control_Create.
/// \param[in] fileDescriptor an open file descriptor to an AMD GPU device. If ADL_UNSET is used, then
/// ADL will use it's own file descriptor.
/// \return ADL_OK if ADLis set to the new mode and uses the new file descriptor, else an ADL error code \ref define_adl_result
/// \remarks Clients can use ADL2 version of the API to assure that there is no interference with other ADL clients that are running in the same process . Such clients have to call \ref ///ADL2_Main_Control_Create first to obtain \ref ADL_CONTEXT_HANDLE instance that has to be passed to each subsequent ADL2 call and finally destroyed using \ref ADL2_Main_Control_Destroy.
int ADL2_ConsoleMode_FileDescriptor_Set(ADL_CONTEXT_HANDLE context, int fileDescriptor);

Thanks a lot. That was a great help.

and, get well soon 😉

0 Likes