Merge branch 'master' of github.com:RfidResearchGroup/proxmark3

This commit is contained in:
iceman1001 2021-01-25 14:15:58 +01:00
commit a658d5dd1e
8 changed files with 136 additions and 138 deletions

View file

@ -4,6 +4,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
## [unreleased][unreleased] ## [unreleased][unreleased]
- Added support for bidirectional communication for `lf em 4x50 sim` (@tharexde) - Added support for bidirectional communication for `lf em 4x50 sim` (@tharexde)
- Change `PLATFORM=PM3OTHER` to `PLATFORM=PM3GENERIC` (@iceman1001)
- Added `tools/hitag2crack/crack5opencl`, an optimized version of `crack5gpu` (@matrix) - Added `tools/hitag2crack/crack5opencl`, an optimized version of `crack5gpu` (@matrix)
- Fixed Makefile to account for changes when running on Apple Silicon (@tcprst) - Fixed Makefile to account for changes when running on Apple Silicon (@tcprst)
- Added support for debugging ARM with JTAG & VSCode (@Gator96100) - Added support for debugging ARM with JTAG & VSCode (@Gator96100)

View file

@ -185,7 +185,7 @@ static void em4x50_setup_sim(void) {
AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK; AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK;
AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT; AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT;
AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK; AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK;
AT91C_BASE_PMC->PMC_PCER |= (1 << AT91C_ID_TC0); AT91C_BASE_PMC->PMC_PCER |= (1 << AT91C_ID_TC0);
AT91C_BASE_PIOA->PIO_BSR = GPIO_SSC_FRAME; AT91C_BASE_PIOA->PIO_BSR = GPIO_SSC_FRAME;
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS; AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
@ -194,7 +194,7 @@ static void em4x50_setup_sim(void) {
// Watchdog hit // Watchdog hit
WDT_HIT(); WDT_HIT();
LEDsoff(); LEDsoff();
} }
@ -1118,7 +1118,7 @@ static void em4x50_sim_send_bit(uint8_t bit) {
// wait until SSC_CLK goes HIGH // wait until SSC_CLK goes HIGH
// used as a simple detection of a reader field? // used as a simple detection of a reader field?
while ((timeout--) && !(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); while ((timeout--) && !(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK));
if (timeout <= 0) { if (timeout <= 0) {
return; return;
} }
@ -1194,19 +1194,19 @@ static void wait_cycles(int maxperiods) {
int period = 0, timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT; int period = 0, timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT;
while (period < maxperiods) { while (period < maxperiods) {
while ((timeout--) && !(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); while ((timeout--) && !(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK));
if (timeout <= 0) { if (timeout <= 0) {
return; return;
} }
timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT; timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT;
while ((timeout--) && (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); while ((timeout--) && (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK));
if (timeout <= 0) { if (timeout <= 0) {
return; return;
} }
timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT; timeout = EM4X50_T_SIMULATION_TIMEOUT_WAIT;
period++; period++;
} }
} }
@ -1232,7 +1232,7 @@ static int em4x50_sim_read_bit(void) {
// gap detected; wait until reader field is switched on again // gap detected; wait until reader field is switched on again
while ((timeout--) && (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); while ((timeout--) && (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK));
if (timeout <= 0) { if (timeout <= 0) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
@ -1259,12 +1259,12 @@ static int em4x50_sim_read_bit(void) {
// read byte in simulation mode either with or without parity check (even) // read byte in simulation mode either with or without parity check (even)
static bool em4x50_sim_read_byte(uint8_t *byte, bool paritycheck) { static bool em4x50_sim_read_byte(uint8_t *byte, bool paritycheck) {
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
*byte <<= 1; *byte <<= 1;
*byte |= em4x50_sim_read_bit(); *byte |= em4x50_sim_read_bit();
} }
if (paritycheck) { if (paritycheck) {
int pval = em4x50_sim_read_bit(); int pval = em4x50_sim_read_bit();
@ -1280,12 +1280,12 @@ static bool em4x50_sim_read_byte(uint8_t *byte, bool paritycheck) {
} }
return true; return true;
} }
// read complete word in simulation mode // read complete word in simulation mode
static bool em4x50_sim_read_word(uint32_t *word) { static bool em4x50_sim_read_word(uint32_t *word) {
uint8_t stop_bit = 0; uint8_t stop_bit = 0;
uint8_t parities = 0, parities_calculated = 0; uint8_t parities = 0, parities_calculated = 0;
uint8_t bytes[4] = {0}; uint8_t bytes[4] = {0};
@ -1306,20 +1306,20 @@ static bool em4x50_sim_read_word(uint32_t *word) {
parities_calculated ^= (bytes[j] >> (7 - i)) & 1; parities_calculated ^= (bytes[j] >> (7 - i)) & 1;
} }
} }
*word = BYTES2UINT32(bytes); *word = BYTES2UINT32(bytes);
// check parities // check parities
if ((parities == parities_calculated) && (stop_bit == 0)) { if ((parities == parities_calculated) && (stop_bit == 0)) {
return true; return true;
} }
return false; return false;
} }
// check if reader requests receive mode (rm) by sending two zeros // check if reader requests receive mode (rm) by sending two zeros
static int check_rm_request(uint32_t *tag) { static int check_rm_request(uint32_t *tag) {
// look for first zero // look for first zero
int bit = em4x50_sim_read_bit(); int bit = em4x50_sim_read_bit();
if (bit == 0) { if (bit == 0) {
@ -1340,13 +1340,13 @@ static int check_rm_request(uint32_t *tag) {
} }
} }
} }
return (bit != PM3_ETIMEOUT) ? PM3_SUCCESS : PM3_ETIMEOUT; return (bit != PM3_ETIMEOUT) ? PM3_SUCCESS : PM3_ETIMEOUT;
} }
// send single listen window in simulation mode // send single listen window in simulation mode
static int em4x50_sim_send_listen_window(uint32_t *tag) { static int em4x50_sim_send_listen_window(uint32_t *tag) {
SHORT_COIL(); SHORT_COIL();
wait_cycles(EM4X50_T_TAG_HALF_PERIOD); wait_cycles(EM4X50_T_TAG_HALF_PERIOD);
@ -1388,7 +1388,7 @@ static void em4x50_sim_send_ack(void) {
OPEN_COIL(); OPEN_COIL();
wait_cycles(EM4X50_T_TAG_HALF_PERIOD); wait_cycles(EM4X50_T_TAG_HALF_PERIOD);
SHORT_COIL(); SHORT_COIL();
} }
@ -1419,7 +1419,7 @@ static void em4x50_sim_send_nak(void) {
// standard read mode process (simulation mode) // standard read mode process (simulation mode)
static int em4x50_sim_handle_standard_read_command(uint32_t *tag) { static int em4x50_sim_handle_standard_read_command(uint32_t *tag) {
int command = 0; int command = 0;
// extract control data // extract control data
@ -1462,11 +1462,11 @@ static int em4x50_sim_handle_standard_read_command(uint32_t *tag) {
static int em4x50_sim_handle_selective_read_command(uint32_t *tag) { static int em4x50_sim_handle_selective_read_command(uint32_t *tag) {
int command = 0; int command = 0;
// read password // read password
uint32_t address = 0; uint32_t address = 0;
bool addr = em4x50_sim_read_word(&address); bool addr = em4x50_sim_read_word(&address);
// processing pause time (corresponds to a "1" bit) // processing pause time (corresponds to a "1" bit)
em4x50_sim_send_bit(1); em4x50_sim_send_bit(1);
@ -1486,7 +1486,7 @@ static int em4x50_sim_handle_selective_read_command(uint32_t *tag) {
int fwrp = reflect32(tag[EM4X50_PROTECTION]) & 0xFF; int fwrp = reflect32(tag[EM4X50_PROTECTION]) & 0xFF;
// last word read protected // last word read protected
int lwrp = (reflect32(tag[EM4X50_PROTECTION]) >> 8) & 0xFF; int lwrp = (reflect32(tag[EM4X50_PROTECTION]) >> 8) & 0xFF;
while ((BUTTON_PRESS() == false) && (data_available() == false)) { while ((BUTTON_PRESS() == false) && (data_available() == false)) {
WDT_HIT(); WDT_HIT();
@ -1521,7 +1521,7 @@ static int em4x50_sim_handle_login_command(uint32_t *tag) {
// read password // read password
uint32_t password = 0; uint32_t password = 0;
bool pwd = em4x50_sim_read_word(&password); bool pwd = em4x50_sim_read_word(&password);
// processing pause time (corresponds to a "1" bit) // processing pause time (corresponds to a "1" bit)
em4x50_sim_send_bit(1); em4x50_sim_send_bit(1);
@ -1548,10 +1548,10 @@ static int em4x50_sim_handle_reset_command(uint32_t *tag) {
em4x50_sim_send_ack(); em4x50_sim_send_ack();
gLogin = false; gLogin = false;
LED_A_OFF(); LED_A_OFF();
// wait for initialization (tinit) // wait for initialization (tinit)
wait_cycles(EM4X50_T_TAG_TINIT); wait_cycles(EM4X50_T_TAG_TINIT);
// continue with standard read mode // continue with standard read mode
return EM4X50_COMMAND_STANDARD_READ; return EM4X50_COMMAND_STANDARD_READ;
} }
@ -1565,7 +1565,7 @@ static int em4x50_sim_handle_write_command(uint32_t *tag) {
// read data // read data
uint32_t data = 0; uint32_t data = 0;
bool word = em4x50_sim_read_word(&data); bool word = em4x50_sim_read_word(&data);
// write access time // write access time
wait_cycles(EM4X50_T_TAG_TWA); wait_cycles(EM4X50_T_TAG_TWA);
@ -1634,7 +1634,7 @@ static int em4x50_sim_handle_write_command(uint32_t *tag) {
} }
break; break;
} }
// EEPROM write time // EEPROM write time
// strange: need some sort of 'waveform correction', otherwise ack signal // strange: need some sort of 'waveform correction', otherwise ack signal
// will not be detected; sending a single "1" as last "bit" of Twee // will not be detected; sending a single "1" as last "bit" of Twee
@ -1666,18 +1666,18 @@ static int em4x50_sim_handle_write_command(uint32_t *tag) {
static int em4x50_sim_handle_writepwd_command(uint32_t *tag) { static int em4x50_sim_handle_writepwd_command(uint32_t *tag) {
bool pwd = false; bool pwd = false;
if (gWritePasswordProcess == false) { if (gWritePasswordProcess == false) {
gWritePasswordProcess = true; gWritePasswordProcess = true;
// read password // read password
uint32_t act_password = 0; uint32_t act_password = 0;
pwd = em4x50_sim_read_word(&act_password); pwd = em4x50_sim_read_word(&act_password);
// processing pause time (corresponds to a "1" bit) // processing pause time (corresponds to a "1" bit)
em4x50_sim_send_bit(1); em4x50_sim_send_bit(1);
if (pwd && (act_password == reflect32(tag[EM4X50_DEVICE_PASSWORD]))) { if (pwd && (act_password == reflect32(tag[EM4X50_DEVICE_PASSWORD]))) {
em4x50_sim_send_ack(); em4x50_sim_send_ack();
gLogin = true; gLogin = true;
@ -1710,7 +1710,7 @@ static int em4x50_sim_handle_writepwd_command(uint32_t *tag) {
em4x50_sim_send_ack(); em4x50_sim_send_ack();
return EM4X50_COMMAND_STANDARD_READ; return EM4X50_COMMAND_STANDARD_READ;
} }
// EEPROM write time // EEPROM write time
// strange: need some sort of 'waveform correction', otherwise ack signal // strange: need some sort of 'waveform correction', otherwise ack signal
// will not be detected; sending a single "1" as last part of Twee // will not be detected; sending a single "1" as last part of Twee
@ -1722,7 +1722,7 @@ static int em4x50_sim_handle_writepwd_command(uint32_t *tag) {
// continue with standard read mode // continue with standard read mode
return EM4X50_COMMAND_STANDARD_READ; return EM4X50_COMMAND_STANDARD_READ;
} }
// call writepwd function again for else branch // call writepwd function again for else branch
return EM4X50_COMMAND_WRITE_PASSWORD; return EM4X50_COMMAND_WRITE_PASSWORD;
} }
@ -1732,15 +1732,15 @@ static int em4x50_sim_handle_writepwd_command(uint32_t *tag) {
// LED B -> standard read mode is active // LED B -> standard read mode is active
// LED C -> command has been transmitted by reader // LED C -> command has been transmitted by reader
void em4x50_sim(uint32_t *password) { void em4x50_sim(uint32_t *password) {
int command = PM3_ENODATA; int command = PM3_ENODATA;
uint8_t *em4x50_mem = BigBuf_get_EM_addr(); uint8_t *em4x50_mem = BigBuf_get_EM_addr();
uint32_t tag[EM4X50_NO_WORDS] = {0x0}; uint32_t tag[EM4X50_NO_WORDS] = {0x0};
for (int i = 0; i < EM4X50_NO_WORDS; i++) for (int i = 0; i < EM4X50_NO_WORDS; i++)
tag[i] = bytes_to_num(em4x50_mem + (i * 4), 4); tag[i] = bytes_to_num(em4x50_mem + (i * 4), 4);
// via eload uploaded dump usually does not contain a password // via eload uploaded dump usually does not contain a password
if (tag[EM4X50_DEVICE_PASSWORD] == 0) { if (tag[EM4X50_DEVICE_PASSWORD] == 0) {
tag[EM4X50_DEVICE_PASSWORD] = reflect32(*password); tag[EM4X50_DEVICE_PASSWORD] = reflect32(*password);
@ -1790,25 +1790,25 @@ void em4x50_sim(uint32_t *password) {
LED_C_ON(); LED_C_ON();
command = em4x50_sim_handle_selective_read_command(tag); command = em4x50_sim_handle_selective_read_command(tag);
break; break;
case EM4X50_COMMAND_STANDARD_READ: case EM4X50_COMMAND_STANDARD_READ:
LED_B_ON(); LED_B_ON();
LED_C_OFF(); LED_C_OFF();
command = em4x50_sim_handle_standard_read_command(tag); command = em4x50_sim_handle_standard_read_command(tag);
break; break;
// bit errors during reading may lead to unknown commands // bit errors during reading may lead to unknown commands
// -> continue with standard read mode // -> continue with standard read mode
default: default:
command = EM4X50_COMMAND_STANDARD_READ; command = EM4X50_COMMAND_STANDARD_READ;
break; break;
} }
// stop if key (pm3 button or enter key) has been pressed // stop if key (pm3 button or enter key) has been pressed
if (command == PM3_EOPABORTED) { if (command == PM3_EOPABORTED) {
break; break;
} }
// if timeout (e.g. no reader field) continue with standard read // if timeout (e.g. no reader field) continue with standard read
// mode and reset former authentication // mode and reset former authentication
if (command == PM3_ETIMEOUT) { if (command == PM3_ETIMEOUT) {

View file

@ -1129,10 +1129,10 @@ int CmdEM4x50Restore(const char *Cmd) {
} }
int CmdEM4x50Sim(const char *Cmd) { int CmdEM4x50Sim(const char *Cmd) {
int status = PM3_EFAILED; int status = PM3_EFAILED;
uint32_t password = 0; uint32_t password = 0;
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "lf em 4x50 sim", CLIParserInit(&ctx, "lf em 4x50 sim",
"Simulates a EM4x50 tag.\n" "Simulates a EM4x50 tag.\n"
@ -1168,7 +1168,7 @@ int CmdEM4x50Sim(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_LF_EM4X50_SIM, (uint8_t *)&password, sizeof(password)); SendCommandNG(CMD_LF_EM4X50_SIM, (uint8_t *)&password, sizeof(password));
PacketResponseNG resp; PacketResponseNG resp;
PrintAndLogEx(INFO, "Press pm3-button to abort simulation"); PrintAndLogEx(INFO, "Press pm3-button to abort simulation");
bool keypress = kbd_enter_pressed(); bool keypress = kbd_enter_pressed();
while (keypress == false) { while (keypress == false) {

View file

@ -38,6 +38,7 @@ Check column "offline" for their availability.
|`analyse nuid `|Y |`create NUID from 7byte UID` |`analyse nuid `|Y |`create NUID from 7byte UID`
|`analyse demodbuff `|Y |`Load binary string to demodbuffer` |`analyse demodbuff `|Y |`Load binary string to demodbuffer`
|`analyse freq `|Y |`Calc wave lengths` |`analyse freq `|Y |`Calc wave lengths`
|`analyse foo `|Y |`muxer`
### data ### data
@ -883,25 +884,25 @@ Check column "offline" for their availability.
|`lf t55xx help `|Y |`This help` |`lf t55xx help `|Y |`This help`
|`lf t55xx clonehelp `|N |`Shows the available clone commands` |`lf t55xx clonehelp `|N |`Shows the available clone commands`
|`lf t55xx config `|Y |`Set/Get T55XX configuration (modulation, inverted, offset, rate)` |`lf t55xx config `|Y |`Set/Get T55XX configuration (modulation, inverted, offset, rate)`
|`lf t55xx dangerraw `|N |`Sends raw bitstream. Dangerous, do not use!! b <bitstream> t <timing>` |`lf t55xx dangerraw `|N |`Sends raw bitstream. Dangerous, do not use!!`
|`lf t55xx detect `|Y |`[1] Try detecting the tag modulation from reading the configuration block.` |`lf t55xx detect `|Y |`Try detecting the tag modulation from reading the configuration block`
|`lf t55xx deviceconfig `|N |`Set/Get T55XX device configuration (startgap, writegap, write0, write1, readgap` |`lf t55xx deviceconfig `|N |`Set/Get T55XX device configuration`
|`lf t55xx dump `|N |`[password] [o] Dump T55xx card Page 0 block 0-7. Optional [password], [override]` |`lf t55xx dump `|N |`Dump T55xx card Page 0 block 0-7`
|`lf t55xx info `|Y |`[1] Show T55x7 configuration data (page 0/ blk 0)` |`lf t55xx info `|Y |`Show T55x7 configuration data (page 0/ blk 0)`
|`lf t55xx p1detect `|N |`[1] Try detecting if this is a t55xx tag by reading page 1` |`lf t55xx p1detect `|N |`Try detecting if this is a t55xx tag by reading page 1`
|`lf t55xx read `|N |`b <block> p [password] [o] [1] -- Read T55xx block data. Optional [p password], [override], [page1]` |`lf t55xx read `|N |`Read T55xx block data`
|`lf t55xx resetread `|N |`Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)` |`lf t55xx resetread `|N |`Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)`
|`lf t55xx restore `|N |`f <filename> [p <password>] Restore T55xx card Page 0 / Page 1 blocks` |`lf t55xx restore `|N |`Restore T55xx card Page 0 / Page 1 blocks`
|`lf t55xx trace `|Y |`[1] Show T55x7 traceability data (page 1/ blk 0-1)` |`lf t55xx trace `|Y |`Show T55x7 traceability data (page 1/ blk 0-1)`
|`lf t55xx wakeup `|N |`Send AOR wakeup command` |`lf t55xx wakeup `|N |`Send AOR wakeup command`
|`lf t55xx write `|N |`b <block> d <data> p [password] [1] -- Write T55xx block data. Optional [p password], [page1]` |`lf t55xx write `|N |`Write T55xx block data`
|`lf t55xx bruteforce `|N |`<start password> <end password> Simple bruteforce attack to find password` |`lf t55xx bruteforce `|N |`Simple bruteforce attack to find password`
|`lf t55xx chk `|N |`Check passwords from dictionary/flash` |`lf t55xx chk `|N |`Check passwords from dictionary/flash`
|`lf t55xx protect `|N |`Password protect tag` |`lf t55xx protect `|N |`Password protect tag`
|`lf t55xx recoverpw `|N |`[password] Try to recover from bad password write from a cloner. Only use on PW protected chips!` |`lf t55xx recoverpw `|N |`Try to recover from bad password write from a cloner`
|`lf t55xx sniff `|Y |`Attempt to recover T55xx commands from sample buffer` |`lf t55xx sniff `|Y |`Attempt to recover T55xx commands from sample buffer`
|`lf t55xx special `|N |`Show block changes with 64 different offsets` |`lf t55xx special `|N |`Show block changes with 64 different offsets`
|`lf t55xx wipe `|N |`[q] Wipe a T55xx tag and set defaults (will destroy any data on tag)` |`lf t55xx wipe `|N |`Wipe a T55xx tag and set defaults (will destroy any data on tag)`
### lf viking ### lf viking

View file

@ -454,12 +454,11 @@ int main(int argc, char **argv) {
if (show) verbose = true; if (show) verbose = true;
// now discover and set up compute device(s) // now discover and set up compute device(s)
if ((err = discoverDevices(profile_selected, device_types_selected, &ocl_platform_cnt, &selected_platforms_cnt, &selected_devices_cnt, &cd_ctx, plat_sel, plat_cnt, dev_sel, dev_cnt, verbose, show)) != 0) if ((err = discoverDevices(profile_selected, device_types_selected, &ocl_platform_cnt, &selected_platforms_cnt, &selected_devices_cnt, &cd_ctx, plat_sel, plat_cnt, dev_sel, dev_cnt, verbose, show)) != 0) {
{ printf("Error: discoverDevices() failed\n");
printf ("Error: discoverDevices() failed\n"); if (err < -5) free(cd_ctx);
if (err < -5) free (cd_ctx); MEMORY_FREE_ALL
MEMORY_FREE_ALL exit(2);
exit (2);
} }
if (verbose) printf("\n"); if (verbose) printf("\n");
@ -776,7 +775,7 @@ int main(int argc, char **argv) {
err = clGetProgramBuildInfo(ctx.programs[z], cd_ctx[w].device[q].device_id, CL_PROGRAM_BUILD_LOG, len, buffer, 0); err = clGetProgramBuildInfo(ctx.programs[z], cd_ctx[w].device[q].device_id, CL_PROGRAM_BUILD_LOG, len, buffer, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("[%zu] clGetProgramBuildInfo() failed (%d)\n", z, err); printf("[%zu] clGetProgramBuildInfo() failed (%d)\n", z, err);
free (buffer); free(buffer);
continue; continue;
} }
@ -787,7 +786,7 @@ int main(int argc, char **argv) {
printf("[%zu] Build log (len %zu):\n--------\n%s\n--------\n", z, len, buffer); printf("[%zu] Build log (len %zu):\n--------\n%s\n--------\n", z, len, buffer);
} }
free (buffer); free(buffer);
build_logs++; build_logs++;
#if DEBUGME == 0 #if DEBUGME == 0
@ -832,7 +831,7 @@ int main(int argc, char **argv) {
} }
// setup, phase 2 (select lower profile) // setup, phase 2 (select lower profile)
unsigned int profile = get_smallest_profile (cd_ctx, ocl_platform_cnt); unsigned int profile = get_smallest_profile(cd_ctx, ocl_platform_cnt);
// setup, phase 3 (finis him) // setup, phase 3 (finis him)
@ -1126,7 +1125,7 @@ int main(int argc, char **argv) {
} }
// Hokuto Hyakuretsu Ken // Hokuto Hyakuretsu Ken
ret = thread_start_scheduler (&th_ctx, t_arg, &ctx.queue_ctx); ret = thread_start_scheduler(&th_ctx, t_arg, &ctx.queue_ctx);
if (ret < 0) { if (ret < 0) {
printf("Error: thread_start_scheduler() failed (%d): %s\n", ret, thread_strerror(ret)); printf("Error: thread_start_scheduler() failed (%d): %s\n", ret, thread_strerror(ret));
error = true; error = true;

View file

@ -40,8 +40,7 @@ bool plat_dev_enabled(unsigned int id, unsigned int *sel, unsigned int cnt, unsi
return false; return false;
} }
unsigned int get_smallest_profile (compute_platform_ctx_t *cd_ctx, size_t ocl_platform_cnt) unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_platform_cnt) {
{
unsigned int profile = 0xff; unsigned int profile = 0xff;
size_t x = 0, y = 0; size_t x = 0, y = 0;
@ -68,8 +67,7 @@ unsigned int get_smallest_profile (compute_platform_ctx_t *cd_ctx, size_t ocl_pl
return profile; return profile;
} }
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show) int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show) {
{
int err = 0; int err = 0;
unsigned int ocl_platform_max = MAX_OPENCL_DEVICES; // 16 unsigned int ocl_platform_max = MAX_OPENCL_DEVICES; // 16
cl_uint ocl_platform_cnt; cl_uint ocl_platform_cnt;
@ -84,13 +82,13 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetPlatformIDs(ocl_platform_max, ocl_platforms, &ocl_platform_cnt); err = clGetPlatformIDs(ocl_platform_max, ocl_platforms, &ocl_platform_cnt);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetPlatformIDs() failed (%d)\n", err); printf("Error: clGetPlatformIDs() failed (%d)\n", err);
free (ocl_platforms); free(ocl_platforms);
return -3; return -3;
} }
if (ocl_platform_cnt == 0) { if (ocl_platform_cnt == 0) {
printf("No platforms found, exit\n"); printf("No platforms found, exit\n");
free (ocl_platforms); free(ocl_platforms);
return -4; return -4;
} }
@ -98,7 +96,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
*cd_ctx = (compute_platform_ctx_t *) calloc(ocl_platform_cnt, sizeof(compute_platform_ctx_t)); *cd_ctx = (compute_platform_ctx_t *) calloc(ocl_platform_cnt, sizeof(compute_platform_ctx_t));
if (*cd_ctx == NULL) { if (*cd_ctx == NULL) {
printf("Error: calloc (compute_platform_ctx_t) failed (%d): %s\n", errno, strerror(errno)); printf("Error: calloc (compute_platform_ctx_t) failed (%d): %s\n", errno, strerror(errno));
free (ocl_platforms); free(ocl_platforms);
return -5; return -5;
} }
@ -120,7 +118,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
(*cd_ctx)[platform_idx].platform_id = ocl_platforms[platform_idx]; (*cd_ctx)[platform_idx].platform_id = ocl_platforms[platform_idx];
(*cd_ctx)[platform_idx].selected = plat_dev_enabled(platform_idx, plat_sel, plat_cnt, 0, 0); (*cd_ctx)[platform_idx].selected = plat_dev_enabled(platform_idx, plat_sel, plat_cnt, 0, 0);
if ((*cd_ctx)[platform_idx].selected) (*selected_platforms_cnt)++; if ((*cd_ctx)[platform_idx].selected)(*selected_platforms_cnt)++;
if (verbose) printf("\n-- Platform ID: %d\n", platform_idx + 1); if (verbose) printf("\n-- Platform ID: %d\n", platform_idx + 1);
@ -130,33 +128,33 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetPlatformInfo((*cd_ctx)[platform_idx].platform_id, ocl_info, 0, NULL, &tmp_len); err = clGetPlatformInfo((*cd_ctx)[platform_idx].platform_id, ocl_info, 0, NULL, &tmp_len);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetPlatformInfo(param size) failed (%d)\n", err); printf("Error: clGetPlatformInfo(param size) failed (%d)\n", err);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -6; return -6;
} }
if (tmp_len > 0) { if (tmp_len > 0) {
if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) { if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) {
printf("Error: calloc (ocl_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno)); printf("Error: calloc (ocl_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno));
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -7; return -7;
} }
err = clGetPlatformInfo((*cd_ctx)[platform_idx].platform_id, ocl_info, tmp_len, tmp_buf, 0); err = clGetPlatformInfo((*cd_ctx)[platform_idx].platform_id, ocl_info, tmp_len, tmp_buf, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetPlatformInfo(param) failed (%d)\n", err); printf("Error: clGetPlatformInfo(param) failed (%d)\n", err);
free (tmp_buf); free(tmp_buf);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -8; return -8;
} }
} else { } else {
tmp_len = 4; tmp_len = 4;
if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) { if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) {
printf("Error: calloc (ocl_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno)); printf("Error: calloc (ocl_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno));
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -7; return -7;
} }
@ -182,13 +180,13 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
} }
if (info_idx == 1) { if (info_idx == 1) {
if (!strncmp(tmp_buf, "NVIDIA", 6)) (*cd_ctx)[platform_idx].is_nv = true; if (!strncmp(tmp_buf, "NVIDIA", 6))(*cd_ctx)[platform_idx].is_nv = true;
else if (!strncmp(tmp_buf, "Apple", 5)) { (*cd_ctx)[platform_idx].is_apple = true; (*cd_ctx)[platform_idx].warning = true; } else if (!strncmp(tmp_buf, "Apple", 5)) { (*cd_ctx)[platform_idx].is_apple = true; (*cd_ctx)[platform_idx].warning = true; }
else if (!strncmp(tmp_buf, "Intel", 5)) (*cd_ctx)[platform_idx].is_intel = true; else if (!strncmp(tmp_buf, "Intel", 5))(*cd_ctx)[platform_idx].is_intel = true;
else if (!strncmp(tmp_buf, "The pocl project", 16)) (*cd_ctx)[platform_idx].is_pocl = true; else if (!strncmp(tmp_buf, "The pocl project", 16))(*cd_ctx)[platform_idx].is_pocl = true;
} }
free (tmp_buf); free(tmp_buf);
} }
if (!show && verbose) { if (!show && verbose) {
@ -203,8 +201,8 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
cl_device_id *ocl_devices = (cl_device_id *) calloc(ocl_device_max, sizeof(cl_device_id)); cl_device_id *ocl_devices = (cl_device_id *) calloc(ocl_device_max, sizeof(cl_device_id));
if (!ocl_devices) { if (!ocl_devices) {
printf("Error: calloc (ocl_devices) failed (%d): %s\n", errno, strerror(errno)); printf("Error: calloc (ocl_devices) failed (%d): %s\n", errno, strerror(errno));
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -7; return -7;
} }
@ -217,9 +215,9 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceIDs(cnt) failed (%d)\n", err); printf("Error: clGetDeviceIDs(cnt) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -9; return -9;
} }
@ -243,13 +241,13 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_device_type), &device_type, 0); err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_device_type), &device_type, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(device_type) failed (%d)\n", err); printf("Error: clGetDeviceInfo(device_type) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
if (device_type & CL_DEVICE_TYPE_GPU) (*cd_ctx)[platform_idx].device[device_idx].is_gpu = 1; if (device_type & CL_DEVICE_TYPE_GPU)(*cd_ctx)[platform_idx].device[device_idx].is_gpu = 1;
else if ((device_type & CL_DEVICE_TYPE_CPU) && (*cd_ctx)[platform_idx].is_pocl) { else if ((device_type & CL_DEVICE_TYPE_CPU) && (*cd_ctx)[platform_idx].is_pocl) {
(*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 1) ? 0 : profile_selected; (*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 1) ? 0 : profile_selected;
} }
@ -258,7 +256,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
(*cd_ctx)[platform_idx].device[device_idx].selected = plat_dev_enabled(global_device_id, dev_sel, dev_cnt, (unsigned int) device_type, device_types_selected); (*cd_ctx)[platform_idx].device[device_idx].selected = plat_dev_enabled(global_device_id, dev_sel, dev_cnt, (unsigned int) device_type, device_types_selected);
global_device_id++; global_device_id++;
if ((*cd_ctx)[platform_idx].device[device_idx].selected) (*selected_devices_cnt)++; if ((*cd_ctx)[platform_idx].device[device_idx].selected)(*selected_devices_cnt)++;
continue; continue;
} else if (info_idx == 5) { } else if (info_idx == 5) {
cl_device_local_mem_type local_mem_type; cl_device_local_mem_type local_mem_type;
@ -266,9 +264,9 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_device_local_mem_type), &local_mem_type, 0); err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_device_local_mem_type), &local_mem_type, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(local_mem_type) failed (%d)\n", err); printf("Error: clGetDeviceInfo(local_mem_type) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
@ -279,9 +277,9 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
(*cd_ctx)[platform_idx].device[device_idx].have_local_memory = true; (*cd_ctx)[platform_idx].device[device_idx].have_local_memory = true;
if ((*cd_ctx)[platform_idx].device[device_idx].is_gpu) { if ((*cd_ctx)[platform_idx].device[device_idx].is_gpu) {
if (profile_selected > 2) (*cd_ctx)[platform_idx].device[device_idx].profile = PROFILE_DEFAULT; // Apple-Intel GPU's if (profile_selected > 2)(*cd_ctx)[platform_idx].device[device_idx].profile = PROFILE_DEFAULT; // Apple-Intel GPU's
} else { } else {
if (profile_selected > 3) (*cd_ctx)[platform_idx].device[device_idx].profile = PROFILE_DEFAULT; // Apple-Intel CPU's if (profile_selected > 3)(*cd_ctx)[platform_idx].device[device_idx].profile = PROFILE_DEFAULT; // Apple-Intel CPU's
} }
} }
} else if ((*cd_ctx)[platform_idx].is_nv) { } else if ((*cd_ctx)[platform_idx].is_nv) {
@ -299,9 +297,9 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(size_t) * 3, wis, 0); err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(size_t) * 3, wis, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(work_items_size) failed (%d)\n", err); printf("Error: clGetDeviceInfo(work_items_size) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
@ -318,9 +316,9 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_uint), &cores, 0); err = clGetDeviceInfo(ocl_device, ocl_dev_info, sizeof(cl_uint), &cores, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(compute_units) failed (%d)\n", err); printf("Error: clGetDeviceInfo(compute_units) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
@ -336,37 +334,37 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
err = clGetDeviceInfo(ocl_device, ocl_dev_info, 0, NULL, &tmp_len); err = clGetDeviceInfo(ocl_device, ocl_dev_info, 0, NULL, &tmp_len);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(param size) failed (%d)\n", err); printf("Error: clGetDeviceInfo(param size) failed (%d)\n", err);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
if (tmp_len > 0) { if (tmp_len > 0) {
if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) { if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) {
printf("Error: calloc (ocl_dev_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno)); printf("Error: calloc (ocl_dev_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno));
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -7; return -7;
} }
err = clGetDeviceInfo(ocl_device, ocl_dev_info, tmp_len, tmp_buf, 0); err = clGetDeviceInfo(ocl_device, ocl_dev_info, tmp_len, tmp_buf, 0);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(param) failed (%d)\n", err); printf("Error: clGetDeviceInfo(param) failed (%d)\n", err);
free (tmp_buf); free(tmp_buf);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
} else { } else {
tmp_len = 4; tmp_len = 4;
if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) { if (!(tmp_buf = (char *) calloc(tmp_len, sizeof(char)))) {
printf("Error: calloc (ocl_dev_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno)); printf("Error: calloc (ocl_dev_info %u) failed (%d): %s\n", info_idx, errno, strerror(errno));
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -7; return -7;
} }
@ -395,10 +393,10 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
} }
if (info_idx == 1) { if (info_idx == 1) {
// force profile to 0-1 with Jetson Nano // force profile to 0-1 with Jetson Nano
if (strstr(tmp_buf, "Tegra") && (*cd_ctx)[platform_idx].is_pocl) { if (strstr(tmp_buf, "Tegra") && (*cd_ctx)[platform_idx].is_pocl) {
(*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 1) ? 0 : profile_selected; (*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 1) ? 0 : profile_selected;
} }
} else if (info_idx == 4) { } else if (info_idx == 4) {
if (!strncmp(tmp_buf, "Intel", 5)) { if (!strncmp(tmp_buf, "Intel", 5)) {
if ((*cd_ctx)[platform_idx].is_apple) { if ((*cd_ctx)[platform_idx].is_apple) {
@ -410,7 +408,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
if ((*cd_ctx)[platform_idx].device[device_idx].is_gpu) { if ((*cd_ctx)[platform_idx].device[device_idx].is_gpu) {
(*cd_ctx)[platform_idx].device[device_idx].profile = 0; // Intel GPU's, work better with a very slow profile (*cd_ctx)[platform_idx].device[device_idx].profile = 0; // Intel GPU's, work better with a very slow profile
} else { } else {
(*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 2) ? PROFILE_DEFAULT : profile_selected; // Intel CPU's (*cd_ctx)[platform_idx].device[device_idx].profile = (profile_selected > 2) ? PROFILE_DEFAULT : profile_selected; // Intel CPU's
} }
} }
} }
@ -423,10 +421,10 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
printf("Error: clGetDeviceInfo(sm_maj/sm_min) failed (%d)\n", err); printf("Error: clGetDeviceInfo(sm_maj/sm_min) failed (%d)\n", err);
free (tmp_buf); free(tmp_buf);
free (ocl_devices); free(ocl_devices);
free (*cd_ctx); free(*cd_ctx);
free (ocl_platforms); free(ocl_platforms);
return -10; return -10;
} }
@ -456,7 +454,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
} }
} }
free (tmp_buf); free(tmp_buf);
} }
if (!show && verbose) printf("%14s: %s\n", "Selected", ((*cd_ctx)[platform_idx].device[device_idx].selected) ? "yes" : "no"); if (!show && verbose) printf("%14s: %s\n", "Selected", ((*cd_ctx)[platform_idx].device[device_idx].selected) ? "yes" : "no");
@ -472,16 +470,16 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
(*cd_ctx)[platform_idx].device[device_idx].device_id = ocl_device; (*cd_ctx)[platform_idx].device[device_idx].device_id = ocl_device;
} }
free (ocl_devices); free(ocl_devices);
ocl_devices = NULL; ocl_devices = NULL;
} }
free (ocl_platforms); free(ocl_platforms);
ocl_platforms = NULL; ocl_platforms = NULL;
*platform_detected_cnt = ocl_platform_cnt; *platform_detected_cnt = ocl_platform_cnt;
if (show) free (*cd_ctx); if (show) free(*cd_ctx);
return 0; return 0;
} }

View file

@ -122,7 +122,7 @@ typedef struct opencl_ctx {
} opencl_ctx_t; } opencl_ctx_t;
bool plat_dev_enabled(unsigned int id, unsigned int *sel, unsigned int cnt, unsigned int cur_type, unsigned int allow_type); bool plat_dev_enabled(unsigned int id, unsigned int *sel, unsigned int cnt, unsigned int cur_type, unsigned int allow_type);
unsigned int get_smallest_profile (compute_platform_ctx_t *cd_ctx, size_t ocl_platform_cnt); unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_platform_cnt);
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *ocl_platform_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show); int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, cl_uint *ocl_platform_cnt, size_t *selected_platforms_cnt, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int dev_cnt, bool verbose, bool show);
int runKernel(opencl_ctx_t *ctx, uint32_t cand_base, uint64_t *matches, uint32_t *matches_found, size_t id); int runKernel(opencl_ctx_t *ctx, uint32_t cand_base, uint64_t *matches, uint32_t *matches_found, size_t id);

View file

@ -176,8 +176,7 @@ int thread_init(thread_ctx_t *ctx, short type, size_t thread_count) {
return 0; return 0;
} }
int thread_start_scheduler (thread_ctx_t *ctx, thread_args_t *t_arg, wu_queue_ctx_t *queue_ctx) int thread_start_scheduler(thread_ctx_t *ctx, thread_args_t *t_arg, wu_queue_ctx_t *queue_ctx) {
{
size_t z = 0; size_t z = 0;
bool found = false; bool found = false;
bool done = false; bool done = false;
@ -775,7 +774,7 @@ void *computing_process_async(void *arg) {
pthread_cond_signal(&a->thread_ctx->thread_cond_usleep); // unlock master/TH_PROCESSING cond pthread_cond_signal(&a->thread_ctx->thread_cond_usleep); // unlock master/TH_PROCESSING cond
#if TDEBUG >= 1 #if TDEBUG >= 1
printf("[%s][%zu] after pthread_cond_signal TH_END\n", __func__, z); printf("[%s][%zu] after pthread_cond_signal TH_END\n", __func__, z);
fflush (stdout); fflush(stdout);
#endif #endif
pthread_mutex_unlock(&a->thread_ctx->thread_mutex_usleep); pthread_mutex_unlock(&a->thread_ctx->thread_mutex_usleep);
} }