Compare commits
4 Commits
c7ba9eb768
...
6db3de1b5c
| Author | SHA1 | Date |
|---|---|---|
|
|
6db3de1b5c | |
|
|
b569c47d40 | |
|
|
014becd12f | |
|
|
8aa0dee3d1 |
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -1,5 +1,6 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="images">
|
<qresource prefix="images">
|
||||||
|
<file>images/settings.png</file>
|
||||||
<file>images/at.png</file>
|
<file>images/at.png</file>
|
||||||
<file>images/pause.png</file>
|
<file>images/pause.png</file>
|
||||||
<file>images/play.png</file>
|
<file>images/play.png</file>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
#include <sndfile.h>
|
#include <sndfile.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <spiralcore/audio.h>
|
#include <spiralcore/audio.h>
|
||||||
|
|
@ -242,10 +243,12 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
m_average_error = calc_average_diff(params)*thresh;
|
m_average_error = calc_average_diff(params)*thresh;
|
||||||
double err = m_average_error*thresh;
|
double err = m_average_error*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
u32 outer_index = 0;
|
std::atomic<u32> progress{0};
|
||||||
for (auto &i : m_blocks) {
|
#pragma omp parallel for
|
||||||
|
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
||||||
|
auto &i = m_blocks[outer_index];
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
||||||
for (auto &j : m_blocks) {
|
for (auto &j : m_blocks) {
|
||||||
if (index!=outer_index) {
|
if (index!=outer_index) {
|
||||||
// collect connections that are under threshold in closeness
|
// collect connections that are under threshold in closeness
|
||||||
|
|
@ -256,30 +259,32 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
++outer_index;
|
++progress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void brain::build_synapses_fixed(search_params ¶ms) {
|
void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
//m_average_error = calc_average_diff(params)*thresh;
|
//m_average_error = calc_average_diff(params)*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
u32 outer_index = 0;
|
|
||||||
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
||||||
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
||||||
|
|
||||||
// need to stop the progress updates flooding osc
|
// need to stop the progress updates flooding osc
|
||||||
u32 update_period = 100;
|
u32 update_period = 100;
|
||||||
u32 update_tick = 0;
|
std::atomic<u32> update_tick{0};
|
||||||
|
std::atomic<u32> progress{0};
|
||||||
for (auto &i:m_blocks) {
|
#pragma omp parallel for
|
||||||
|
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
||||||
|
auto &i = m_blocks[outer_index];
|
||||||
if (update_tick>update_period) {
|
if (update_tick>update_period) {
|
||||||
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
||||||
update_tick=0;
|
update_tick=0;
|
||||||
}
|
}
|
||||||
update_tick++;
|
update_tick++;
|
||||||
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
vector<pair<u32,double>> collect;
|
vector<pair<u32,double>> collect;
|
||||||
|
collect.reserve(brain_size);
|
||||||
|
|
||||||
// collect comparisons to all other blocks
|
// collect comparisons to all other blocks
|
||||||
for (auto &j:m_blocks) {
|
for (auto &j:m_blocks) {
|
||||||
|
|
@ -304,7 +309,7 @@ void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
i.get_synapse().push_back(collect[n].first);
|
i.get_synapse().push_back(collect[n].first);
|
||||||
}
|
}
|
||||||
|
|
||||||
++outer_index;
|
++progress;
|
||||||
}
|
}
|
||||||
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>samplebrain 0.18.3</string>
|
<string>samplebrain 0.18.4</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
|
@ -1572,7 +1572,20 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>settings</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../app/samplebrain.qrc">
|
||||||
|
<normaloff>:/images/images/settings.png</normaloff>:/images/images/settings.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1607,8 +1620,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../app/samplebrain.qrc"/>
|
<include location="../app/samplebrain.qrc"/>
|
||||||
<include location="../app/samplebrain.qrc"/>
|
|
||||||
<include location="../app/samplebrain.qrc"/>
|
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ SOURCES += app/MainWindow.cpp \
|
||||||
INCLUDEPATH += brain/src
|
INCLUDEPATH += brain/src
|
||||||
INCLUDEPATH += /usr/local/include
|
INCLUDEPATH += /usr/local/include
|
||||||
INCLUDEPATH += /opt/homebrew/include
|
INCLUDEPATH += /opt/homebrew/include
|
||||||
LIBS += -L.. -L/usr/local/lib -L/opt/homebrew/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
LIBS += -L.. -L/usr/local/lib -L/opt/homebrew/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm -fopenmp
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -O3 -Wall -Wno-unused -std=c++11
|
QMAKE_CXXFLAGS += -O3 -fopenmp -Wall -Wno-unused -std=c++11
|
||||||
|
|
||||||
# assets
|
# assets
|
||||||
RESOURCES = app/samplebrain.qrc
|
RESOURCES = app/samplebrain.qrc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue