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

[NOT WORKING] Add MacOS support #289

Closed
wants to merge 1 commit into from
Closed

Conversation

proski
Copy link
Contributor

@proski proski commented Aug 13, 2024

Unresolved issues:

  • Fails in clCompileProgram
  • conversion warnings between long double and f128

Unresolved issues:

* Fails in clCompileProgram
* conversion warnings between long double and f128
HOST_OS = $(shell uname -s)

ifeq ($(HOST_OS), Darwin)
CXX = g++-14 # from homebrew, needed for 128-bit floats
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Apple clang doesn't support C++-20 enough to compile filesystem operations. It doesn't have any 128-bit float, as far as I can tell. The real GCC resolves those issues.

COMMON_FLAGS = -Wall -std=c++20
# -static-libstdc++ -static-libgcc
# -fext-numeric-literals

ifeq ($(HOST_OS), Darwin)
OPENCL_LIBS = -framework OpenCL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a weird way to link to a library, but it's needed and GCC supports it. Copied form mfakto.

Comment on lines +126 to 127
ldouble angle = - M_PIl * k / N;
return {cosl(angle), sinl(angle)};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a good solution here. The MacOS long double is equivalent to double, and functions like cosl expect long double i.e. double.

@@ -14,7 +14,7 @@
#endif

static_assert(sizeof(double2) == 16, "size double2");
static_assert(sizeof(long double) > sizeof(double), "long double offers extended precision");
static_assert(sizeof(ldouble) > sizeof(double), "long double offers extended precision");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the extended precision?

@@ -67,6 +67,10 @@ int clReleaseKernel(cl_kernel);
cl_mem clCreateBuffer(cl_context, cl_mem_flags, size_t, void *, int *);
int clReleaseMemObject(cl_mem);
cl_command_queue clCreateCommandQueueWithProperties(cl_context, cl_device_id, const cl_queue_properties *, int *);
#ifdef __APPLE__
cl_command_queue clCreateCommandQueueWithPropertiesAPPLE(cl_context, cl_device_id, const cl_queue_properties *, int *);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cl_queue_properties has extra flags, but it shouldn't matter if we are not using them.

@proski
Copy link
Contributor Author

proski commented Aug 14, 2024

It looks like there are bigger problems with the OpenCL support on MacOS that I don't have time to solve, so I'm closing this PR.

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

Successfully merging this pull request may close these issues.

1 participant