void setup(){ //Show name plate for(uint8_t i = 0; i < 5; i++){ show_name(GRN_1); _delay_ms(100); show_name(GRN_2); _delay_ms(100); show_name(GRN_3); _delay_ms(100); show_name(RED_1 | GRN_3); _delay_ms(100); show_name(RED_2 | GRN_3); _delay_ms(100); show_name(RED_3 | GRN_3); _delay_ms(100); show_name(RED_3 | GRN_2); _delay_ms(100); show_name(RED_3 | GRN_1); _delay_ms(100); show_name(RED_3); _delay_ms(100); show_name(RED_2); _delay_ms(100); show_name(RED_1); _delay_ms(100); show_name(RED_2); _delay_ms(100); show_name(RED_3); _delay_ms(100); show_name(RED_3 | GRN_1); _delay_ms(100); show_name(RED_3 | GRN_2); _delay_ms(100); show_name(RED_3 | GRN_3); _delay_ms(100); show_name(RED_2 | GRN_3); _delay_ms(100); show_name(RED_1 | GRN_3); _delay_ms(100); show_name(GRN_3); _delay_ms(100); show_name(GRN_2); _delay_ms(100); } //Clear board clear_scratch(); flush(); matrix_write_buffer(); _delay_ms(100); //Random start positions for (uint8_t x = 0; x < MATRIX_WIDTH; x++){ for (uint8_t y = 0; y < MATRIX_HEIGHT; y++){ if ((random() & 0x3) == 0x3){ //25% chance set_scratch(x, y, GRN_1); } } } for (uint8_t i = 0; i < RECENT_HASH_COUNT; i++){ recent_hashes[i] = i; } flush(); matrix_write_buffer(); }
void OpenMPexec::resize_scratch( size_t reduce_size , size_t thread_size ) { enum { ALIGN_MASK = Kokkos::Impl::MEMORY_ALIGNMENT - 1 }; enum { ALLOC_EXEC = ( sizeof(OpenMPexec) + ALIGN_MASK ) & ~ALIGN_MASK }; const size_t old_reduce_size = m_pool[0] ? m_pool[0]->m_scratch_reduce_end : 0 ; const size_t old_thread_size = m_pool[0] ? m_pool[0]->m_scratch_thread_end - m_pool[0]->m_scratch_reduce_end : 0 ; reduce_size = ( reduce_size + ALIGN_MASK ) & ~ALIGN_MASK ; thread_size = ( thread_size + ALIGN_MASK ) & ~ALIGN_MASK ; // Requesting allocation and old allocation is too small: const bool allocate = ( old_reduce_size < reduce_size ) || ( old_thread_size < thread_size ); if ( allocate ) { if ( reduce_size < old_reduce_size ) { reduce_size = old_reduce_size ; } if ( thread_size < old_thread_size ) { thread_size = old_thread_size ; } } const size_t alloc_size = allocate ? ALLOC_EXEC + reduce_size + thread_size : 0 ; const int pool_size = m_pool_topo[0] ; if ( allocate ) { clear_scratch(); #pragma omp parallel { const int rank_rev = m_map_rank[ omp_get_thread_num() ]; const int rank = pool_size - ( rank_rev + 1 ); m_pool.at(rank_rev) = HostSpace::allocate_and_track( "openmp_scratch", alloc_size ); new ( m_pool[ rank_rev ] ) OpenMPexec( rank , ALLOC_EXEC , reduce_size , thread_size ); } /* END #pragma omp parallel */ } }
void setup(){ srandom(analog_read_p(0) + timer_micros() + timer_millis()); //Flash palette flash_palette(GRN_1); _delay_ms(100); flash_palette(GRN_2); _delay_ms(100); flash_palette(GRN_3); _delay_ms(100); flash_palette(RED_1 | GRN_3); _delay_ms(100); flash_palette(RED_2 | GRN_3); _delay_ms(100); flash_palette(RED_3 | GRN_3); _delay_ms(100); flash_palette(RED_3 | GRN_2); _delay_ms(100); flash_palette(RED_3 | GRN_1); _delay_ms(100); flash_palette(RED_3); _delay_ms(100); flash_palette(RED_2); _delay_ms(100); flash_palette(RED_1); _delay_ms(100); //Clear board clear_scratch(); flush(); matrix_write_buffer(); _delay_ms(100); //Random start positions for (uint8_t x = 0; x < MATRIX_WIDTH; x++){ for (uint8_t y = 0; y < MATRIX_HEIGHT; y++){ if ((random() & 0x3) == 0x3){ //25% chance set_scratch(x, y, GRN_1); } } } for (uint8_t i = 0; i < RECENT_HASH_COUNT; i++){ recent_hashes[i] = i; } flush(); matrix_write_buffer(); }