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

fixed incorrect hashrate on mac os and fixed some memleaks #47

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

gjwang
Copy link

@gjwang gjwang commented Nov 9, 2016

No description provided.

@DavidVorick
Copy link
Member

Thanks for the pull request!

We'll get to reviewing this as soon as we can.

printf("\tDevice %d: %s\n", j, str);
} else {
printf("\tDevice %d: %s\n", j, str);
}
Copy link
Member

Choose a reason for hiding this comment

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

if we can't read the device name, does it make sense to continue printing the endianness, alloc size, etc.? I figure if one fails, the rest will probably fail too. I'm not very familiar of OpenCL, though; maybe not all devices have names.

Copy link
Member

@lukechampine lukechampine Nov 12, 2016

Choose a reason for hiding this comment

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

Also, if we can assume that all devices have names, then the rest of the info should be printed with a double tab instead of repeating the device id. For example:

Found 1 platform(s) on your computer.
    Device 0 (MyDevice):
        Endianness:    Little-endian
        Address space: 64-bit

instead of:

Found 1 platform(s) on your computer.
    Device 0: MyDevice
    Device 0: Endianness: Little-endian
    Device 0: Address space: 64-bit

I suppose having a uniform prefix is handy if you want to pipe the output to grep or something, but I imagine you only need to do that if you have lots of devices.

printf("\tError while getting device CL_DEVICE_ENDIAN_LITTLE.\n");
} else {
printf("\tDevice %d: isLitlle: %d\n", j, isLitlle);
}
Copy link
Member

Choose a reason for hiding this comment

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

could be more descriptive here. How about:

else if (isLittle) {
    printf("\t\tEndianness: Little-endian\n");
} else {
    printf("\t\tEndianness: Big-endian\n");
}

also, please ensure that your new code is properly indented.

gettimeofday(&now, NULL);
return now.tv_sec * 1000000LL + now.tv_usec;
#else
return clock()/ CLOCKS_PER_SEC * 1000000LL;
Copy link
Member

Choose a reason for hiding this comment

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

seems like there are a lot of ways to get the current timestamp. This post describes the differences between various functions. I also found this gist by jbenet which shows how to get the current time on OS X. Not sure what the situation is like for Windows.

@lukechampine
Copy link
Member

Looks good overall. I would prefer to see the device info printed in a nicer format. Aside from that, just make sure you follow our current style, specifically:

  • Tabs for indentation
  • Open brace on the same line, separated by a space (e.g. foo() {)

@lukechampine
Copy link
Member

Excellent. I think this is good to merge, but I would like to confirm that it behaves as intended on Windows and Linux as well. @DavidVorick, can we push this out to some miners and get their feedback?

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

Successfully merging this pull request may close these issues.

3 participants