-
Notifications
You must be signed in to change notification settings - Fork 2
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
Setup is being failed #2
Comments
Hello, |
Thanks a lot for your email. I need to switch to ubuntu now.
On Thu, 24 Sep 2020 at 1:42 PM, daothinga ***@***.***> wrote:
Hello,
I faced the same problem when trying to install hwcounter package on
windows 10.
Later, this package was successfully installed on Ubuntu 20.0.
Hope the answer is helpful to you.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZJO75UDDLKHVUN4DFTUBLSHLL2VANCNFSM4K7DS75Q>
.
--
My Web Presence <http://saef.eiwabd.com/>
|
I use also Ubuntu, but it doesn't work too, becasue of same problem, with error Status 1 |
This comment was marked as resolved.
This comment was marked as resolved.
Everywhere, everyone says not to use the inline assembly for RDTSC on Windows, because it's too messy and there is already support for intrinsics. The code here, reads: #define HWCOUNTER_GET_TIMESTAMP(count_ptr) \
do { \
uint32_t count_high, count_low; \
asm volatile ( \
"cpuid\n\t" \
"rdtsc\n\t" \
: "=a" (count_low), "=d" (count_high) \
:: "ebx", "ecx"); \
*count_ptr = ((uint64_t)count_high << 32) | count_low; \
} while(0)
#define HWCOUNTER_GET_TIMESTAMP_END(count_ptr) \
do { \
uint32_t count_high, count_low; \
asm volatile ( \
"rdtscp\n\t" \
"mov %%edx, %0\n\t" \
"mov %%eax, %1\n\t" \
"cpuid\n\t" \
: "=r" (count_high), "=r" (count_low) \
:: "eax", "ebx", "ecx", "edx"); \
*count_ptr = ((uint64_t)count_high << 32) | count_low; \
} while(0) Some questions.
and that:
Windows & RDTSCIn Windows, the basic example simply reads: // rdtsc.cpp
// processor: x86, x64
#include <stdio.h>
#ifdef _WIN32
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#pragma intrinsic(__rdtsc)
int main()
{
unsigned __int64 i;
i = __rdtsc();
printf_s("%I64d ticks\n", i);
}
For Windows MS Visual Studio or VC, we need to use:
In either case I managed to use MSYS2 MinGW compiler without an issue, by using the methods mentioned here: |
Fixed! The following changes will fix #if defined(_MSC_BUILD) && defined(_WIN32)
//---------------------------------------------------------
// For Windows MSVC C/C++ Compatibility
//---------------------------------------------------------
#include <intrin.h>
#pragma intrinsic(__rdtsc)
#define HWCOUNTER_GET_TIMESTAMP(count_ptr) do { *count_ptr = (uint64_t) __rdtsc(); } while(0)
#define HWCOUNTER_GET_TIMESTAMP_END(count_ptr) do { uint32_t ui; *count_ptr = (uint64_t) __rdtscp(&ui); } while(0)
#else
//---------------------------------------------------------
// For other Compilers or Platforms
//---------------------------------------------------------
#define HWCOUNTER_GET_TIMESTAMP(count_ptr) \
do { \
uint32_t count_high, count_low; \
asm volatile ( \
"cpuid\n\t" \
"rdtsc\n\t" \
: "=a" (count_low), "=d" (count_high) \
:: "ebx", "ecx"); \
*count_ptr = ((uint64_t)count_high << 32) | count_low; \
} while(0)
#define HWCOUNTER_GET_TIMESTAMP_END(count_ptr) \
do { \
uint32_t count_high, count_low; \
asm volatile ( \
"rdtscp\n\t" \
"mov %%edx, %0\n\t" \
"mov %%eax, %1\n\t" \
"cpuid\n\t" \
: "=r" (count_high), "=r" (count_low) \
:: "eax", "ebx", "ecx", "edx"); \
*count_ptr = ((uint64_t)count_high << 32) | count_low; \
} while(0)
//---------------------------------------------------------
#endif
uint64_t
hwcounter_measure_overhead(void) {
uint64_t t0, t1, elapsed, overhead = ~0;
// We should probably average over many more, maybe 3,000,000 ?
// https://www.intel.com/content/www/us/en/embedded/training/ia-32-ia-64-benchmark-code-execution-paper.html
for (int i = 0; i < 3; i++) {
HWCOUNTER_GET_TIMESTAMP(&t0);
#if defined(_MSC_BUILD) && defined(_WIN32)
void __nop();
#else
asm volatile("");
#endif
HWCOUNTER_GET_TIMESTAMP_END(&t1);
elapsed = t1 - t0;
if (elapsed < overhead)
overhead = elapsed;
}
return overhead;
} |
Hello All, after editing the patch a explained by @eabase getting this error
anyone sees why this link issue? |
@pgarraul Why are you using Also try changing the includes to:
|
Thank you so much @eabase for your prompt reply. tried the following without success header for hwcounter.c
command: (.venv) PS C:\test> pip install -vvv .\hwcounter-0.1.1.tar.gz
Given the error: is it possible to download the wheel built for windows 10 64bits from somewhere? |
Sorry, mate, IDK. I was using VS 2019. Also make sure to remove all build artifacts after each run of pip install. Seem like VS like to reuse old compile objects. (And I also had the toml file disabled.) |
@pgarraul It seem that you're missing having installed $env:SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
pip install -e . --config-settings editable_mode=compat
# Deprecated?
$env:SETUPTOOLS_USE_DISTUTILS="stdlib" |
python version 3.7 and pip version 19.0.3
After issuing pip install hwcounter the following message are showing. Could you please check it.
C:\Users\mdsae>pip install hwcounter
Collecting hwcounter
Using cached https://files.pythonhosted.org/packages/83/8d/855522fe8beb584e7ce748e551122943607655628c7a4a1be0270e2d8c07/hwcounter-0.1.1.tar.gz
Building wheels for collected packages: hwcounter
Building wheel for hwcounter (setup.py) ... error
Complete output from command C:\Users\mdsae\anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\mdsae\AppData\Local\Temp\pip-install-_3i9s9z1\hwcounter\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\mdsae\AppData\Local\Temp\pip-wheel-xzvzksnp --python-tag cp37:
running bdist_wheel
running build
running build_ext
building 'hwcounter' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\mdsae\anaconda3\include -IC:\Users\mdsae\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tchwcounter.c /Fobuild\temp.win-amd64-3.7\Release\hwcounter.obj
hwcounter.c
hwcounter.c(36): error C2065: 'asm': undeclared identifier
hwcounter.c(36): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(37): error C2065: 'asm': undeclared identifier
hwcounter.c(37): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(38): error C2065: 'asm': undeclared identifier
hwcounter.c(38): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(54): error C2065: 'asm': undeclared identifier
hwcounter.c(54): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(65): error C2065: 'asm': undeclared identifier
hwcounter.c(65): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(103): error C2065: 'asm': undeclared identifier
hwcounter.c(103): error C2143: syntax error: missing ';' before 'volatile'
hwcounter.c(115): error C2065: 'asm': undeclared identifier
hwcounter.c(115): error C2143: syntax error: missing ';' before 'volatile'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe' failed with exit status 2
Failed building wheel for hwcounter
Running setup.py clean for hwcounter
Failed to build hwcounter
The text was updated successfully, but these errors were encountered: