Technology-Array-Algorithm Co-Optimization of RRAM for Storage and Neuromorphic Computing: Device Non-idealities and Thermal Cross-talk