Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::numeric_limits<_T>::infinity() compilation problem #659

Closed
ekondis opened this issue Mar 17, 2018 · 1 comment
Closed

std::numeric_limits<_T>::infinity() compilation problem #659

ekondis opened this issue Mar 17, 2018 · 1 comment

Comments

@ekondis
Copy link

ekondis commented Mar 17, 2018

The following source fails to compile on ROCm v1.7.1:

#include <hcc/hc.hpp>

#include <iostream>
#include <limits>

void f(float *data) [[hc]] [[cpu]] {
    *data = std::numeric_limits<float>::infinity();
}

int main(void){
	float data = 0.0f;
	constexpr int N = 1;

	hc::array_view<float, 1> v_data(N, &data);
	hc::parallel_for_each( hc::extent<1>(N), [=](hc::index<1> i) [[hc]] { f(v_data.accelerator_pointer()); } );
	v_data.synchronize();

	std::cout << data << std::endl;
	return 0;
}

with error:

 error:  'std::numeric_limits<float>::infinity': no overloaded function has restriction specifiers that are
      compatible with the ambient context 'f'
    *data = std::numeric_limits<float>::infinity();
                                                ^
1 error generated.

This issue was first reported for HIP (Issue-374)

@sunway513
Copy link
Contributor

Hi @ekondis , please refer to the updated comments from @AlexVlx in the original HIP issue. Essentially the usage is not officially supported in hip/hcc.
Could you fix it in your code base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants