Main runs algorithm, detect serial or parallel.