1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Set default device-type to GPU with Apple M1

This commit is contained in:
Gabriele Gristina 2021-12-14 00:37:17 +01:00
parent 0fae3a4394
commit 3fd6dac523

View File

@ -341,11 +341,27 @@ static bool setup_opencl_device_types_filter (hashcat_ctx_t *hashcat_ctx, const
{ {
#if defined (__APPLE__) #if defined (__APPLE__)
// For apple use CPU only, because GPU drivers are not reliable #include <sys/sysctl.h>
// The user can explicitly enable GPU by setting -D2
//opencl_device_types_filter = CL_DEVICE_TYPE_ALL & ~CL_DEVICE_TYPE_GPU; size_t size;
opencl_device_types_filter = CL_DEVICE_TYPE_CPU; cpu_type_t cpu_type = 0;
size = sizeof (cpu_type);
sysctlbyname ("hw.cputype", &cpu_type, &size, NULL, 0);
if (cpu_type == 0x100000c)
{
// For apple M1* use GPU only, because CPU device it is not recognized by OpenCL
opencl_device_types_filter = CL_DEVICE_TYPE_GPU;
}
else
{
// For apple use CPU only, because GPU drivers are not reliable
// The user can explicitly enable GPU by setting -D2
//opencl_device_types_filter = CL_DEVICE_TYPE_ALL & ~CL_DEVICE_TYPE_GPU;
opencl_device_types_filter = CL_DEVICE_TYPE_CPU;
}
#else #else